Types
GitBranchType = git_branch_t
- Source Edit
GitCheckoutNotify = git_checkout_notify_t
- Source Edit
GitCheckoutStrategy = git_checkout_strategy_t
- Source Edit
GitErrorClass = git_error_t
- Source Edit
GitObjectKind = git_object_t
- Source Edit
GitPathSpec = ptr git_pathspec
- Source Edit
GitPathSpecFlag = git_pathspec_flag_t
- Source Edit
GitReference = ptr git_reference
- Source Edit
GitRepository = ptr git_repository
- Source Edit
GitRepoState = git_repository_state_t
- Source Edit
GitResult[T] = Result[T, GitResultCode]
- Source Edit
GitResultCode = git_error_code
- Source Edit
GitRevWalker = ptr git_revwalk
- Source Edit
GitSignature = ptr git_signature
- Source Edit
GitStatusFlag = git_status_t
- Source Edit
GitStatusList = ptr git_status_list
- Source Edit
GitStatusOption = git_status_opt_t
- Source Edit
GitStatusShow = git_status_show_t
- Source Edit
GitStrArray = distinct git_strarray
- strings freed by libgit2 Source Edit
GitTagTable = OrderedTableRef[string, GitThing]
- Source Edit
GitThing = ref object o*: GitObject case kind*: GitObjectKind of GIT_OBJECT_TAG: nil of GIT_OBJECT_REF_DELTA: nil of GIT_OBJECT_TREE: nil else: nil
- Source Edit
GitTreeEntries = seq[GitTreeEntry]
- Source Edit
GitTreeEntry = ptr git_tree_entry
- Source Edit
GitTreeWalkCallback = proc (root: cstring; entry: ptr git_tree_entry; payload: pointer): cint
- Source Edit
GitTreeWalkMode = git_treewalk_mode
- Source Edit
GittyStrArray = distinct git_strarray
- strings freed by nim Source Edit
Procs
func `$`(annotated: ptr git_annotated_commit): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(entry: GitTreeEntry): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(obj: GitObject): string {....raises: [], tags: [], forbids: [].}
- string representation of git object Source Edit
func `$`(ps: GitPathSpec): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(reference: GitReference): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(repo: GitRepository): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(tags: GitTagTable): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func `$`(walker: GitRevWalker): string {....raises: [], tags: [], forbids: [].}
- Source Edit
proc branchName(got: GitReference): string {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch a branch name assuming the reference is a branch Source Edit
proc branchRemoteName(repo: GitRepository; branch: string): GitResult[string] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- try to fetch a single remote for a remote tracking branch Source Edit
proc branchUpstream(branch: GitReference): GitResult[GitReference] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- retrieve remote tracking reference for a branch reference Source Edit
proc checkoutHead(repo: GitRepository; strategy = defaultCheckoutStrategy): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- checkout a repository's head Source Edit
proc checkoutTree(repo: GitRepository; reference: string; paths: seq[string] = @[]; strategy = defaultCheckoutStrategy): GitResultCode {. ...raises: [Exception, OSError, ResultError[system.void]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- checkout a repository using a reference string; supply paths to limit the checkout to, uh, those particular paths Source Edit
proc checkoutTree(repo: GitRepository; thing: GitThing; paths: seq[string] = @[]; strategy = defaultCheckoutStrategy): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- checkout a repository using a thing; supply paths to limit the checkout to, uh, those particular paths Source Edit
proc clone(uri: Uri; path: string; branch = ""): GitResult[GitRepository] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- clone a repository Source Edit
proc committer(thing: GitThing): GitSignature {....raises: [], tags: [], forbids: [].}
- get the committer of a thing that's a commit Source Edit
proc copy(commit: GitCommit): GitResult[GitCommit] {....raises: [], tags: [], forbids: [].}
- create a copy of the commit; free it with free Source Edit
proc defaultSignature(repo: GitRepository): GitResult[GitSignature] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new signature using git configuration; must be freed Source Edit
proc defaultSignature(repo: GitRepository; time: Time): GitResult[GitSignature] {....raises: [ Exception, OSError, ResultError[errors.git_error_code], ResultError[system.void], Exception, OSError, ResultError[errors.git_error_code], ResultError[system.void]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new signature using git configuration; must be freed Source Edit
proc dumpError(code: GitResultCode): string {....raises: [], tags: [], forbids: [].}
- retrieves the last git error message Source Edit
proc fetchRemote(repo: GitRepository; remoteName: string): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch from repo at given remoteName Source Edit
proc fetchRemote(repo: GitRepository; remoteName: string; refSpecs: GittyStrArray): GitResultCode {. ...raises: [Exception, OSError, Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch from repo at remoteName using provided refSpecs Source Edit
proc fetchRemotes(repo: GitRepository; remoteNames: seq[string]): seq[ GitResultCode] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch from repo at given remoteNames Source Edit
proc flags(status: GitStatus): set[GitStatusFlag] {....raises: [], tags: [], forbids: [].}
- produce the set of flags indicating the status of the file Source Edit
proc free(entries: sink GitTreeEntries) {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- git tree entries need a special free Source Edit
proc free(gstrings: var GitStrArray) {....raises: [], tags: [], forbids: [].}
- free a git_strarray allocated by libgit2 Source Edit
proc free(gstrings: var GittyStrArray) {....raises: [], tags: [], forbids: [].}
- free a git_strarray allocated by nim Source Edit
proc free(s: string) {....raises: [], tags: [], forbids: [].}
- for template compatability only Source Edit
proc free(table: sink GitTagTable) {....raises: [Exception, OSError], tags: [ ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- free a tag table Source Edit
proc getHeadOid(repo: GitRepository): GitResult[GitOid] {. ...raises: [Exception, OSError, ResultError[system.void]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- try to retrieve the #head oid from a repository Source Edit
proc getRemoteNames(repo: GitRepository): GitResult[seq[string]] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- get names of all remotes Source Edit
proc hash(gcs: GitCheckoutStrategy): Hash {....raises: [], tags: [], forbids: [].}
- too large an enum for native sets Source Edit
proc hash(oid: GitOid): Hash {....raises: [], tags: [], forbids: [].}
- the hash of a git oid is a function of its string representation Source Edit
proc hasThing(tags: GitTagTable; thing: GitThing): bool {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- true if the thing is tagged; think hasValue() to table's hasKey() Source Edit
proc headReference(repo: GitRepository): GitResult[GitReference] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- alias for repositoryHead Source Edit
proc isBranch(got: GitReference): bool {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- true if the supplied reference is a branch Source Edit
func isTag(got: GitReference): bool {....raises: [], tags: [], forbids: [].}
- true if the supplied reference is a tag Source Edit
proc lookupCommit(repo: GitRepository; oid: GitOid): GitResult[GitThing] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- try to look a commit up in the repository with the given name Source Edit
proc lookupThing(repo: GitRepository; name: string): GitResult[GitThing] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- try to look some thing up in the repository with the given name Source Edit
proc lookupTreeThing(repo: GitRepository; path = "HEAD"): GitResult[GitThing] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- convenience to lookup a thing with a tree type filter Source Edit
proc message(commit: GitCommit): string {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- retrieve the message associated with a git commit Source Edit
func name(entry: GitTreeEntry): string {....raises: [], tags: [], forbids: [].}
- retrieve the name of the input Source Edit
func name(got: GitReference): string {....raises: [], tags: [], forbids: [].}
- retrieve the name of the input Source Edit
proc newPathSpec(spec: openArray[string]): GitResult[GitPathSpec] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- instantiate a new path spec from a strarray Source Edit
proc newRevWalk(repo: GitRepository): GitResult[GitRevWalker] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- instantiate a new walker Source Edit
proc newSignature(name, email: string; time: Time): GitResult[GitSignature] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new signature using arguments; must be freed (this does not yet support the offset-in-minutes specification) Source Edit
proc newTagTable(size = 32): GitTagTable {....raises: [], tags: [], forbids: [].}
- instantiate a new tag table Source Edit
proc oid(entry: GitTreeEntry): GitOid {....raises: [], tags: [], forbids: [].}
- retrieve the oid of the input Source Edit
proc oid(got: GitReference): GitOid {....raises: [], tags: [], forbids: [].}
- retrieve the oid of the input Source Edit
proc oid(obj: GitObject): GitOid {....raises: [], tags: [], forbids: [].}
- retrieve the oid of the input Source Edit
proc openRepository(path: string): GitResult[GitRepository] {. ...deprecated: "use repositoryOpen", raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- repositoryOpen Source Edit alias for
proc owner(commit: GitCommit): GitRepository {....raises: [], tags: [], forbids: [].}
- retrieve the repository that owns this commit Source Edit
proc owner(reference: GitReference): GitRepository {....raises: [], tags: [], forbids: [].}
- retrieve the repository that owns this reference Source Edit
proc owner(thing: GitThing): GitRepository {....raises: [], tags: [], forbids: [].}
- retrieve the repository that owns this thing Source Edit
proc push(walker: GitRevWalker; oid: GitOid): GitResultCode {. ...raises: [Exception, OSError, ResultError[system.void]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- add a starting oid for the walker to begin at Source Edit
proc referenceDWIM(repo: GitRepository; short: string): GitResult[GitReference] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- turn a string into a reference Source Edit
proc remoteCreate(repo: GitRepository; name: string; url: Uri): GitResult[ GitRemote] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new remote in the repository Source Edit
proc remoteDelete(repo: GitRepository; name: string): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- delete a remote from the repository Source Edit
proc remoteLookup(repo: GitRepository; name: string): GitResult[GitRemote] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- get the remote by name; the remote must be freed Source Edit
proc remoteRename(repo: GitRepository; prior: string; next: string): GitResult[ seq[string]] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- rename a remote Source Edit
proc repositoryDiscover(path: string; ceilings: seq[string] = @[]; xfs = true): GitResult[ string] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- try to find the path of a repository in path or a parent; xfs allows cross-filesystem traversal, while ceilings holds stop-dirs. Source Edit
proc repositoryHead(repo: GitRepository): GitResult[GitReference] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch the reference for the repository's head; the reference must be freed Source Edit
proc repositoryOpen(path: string): GitResult[GitRepository] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- open a repository by path; the repository must be freed Source Edit
proc repositoryPath(repo: GitRepository): string {....raises: [], tags: [], forbids: [].}
- the path of the .git folder, or the repo itself if it's bare Source Edit
proc repositoryState(repository: GitRepository): GitRepoState {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- fetch the state of a repository Source Edit
proc setBranchUpstream(branch: GitReference; name: string): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- set the upstream for the branch to the given branch name Source Edit
proc setHead(repo: GitRepository; short: string): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- set the head of a repository Source Edit
proc setHeadDetached(repo: GitRepository; oid: GitOid): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- detach the HEAD and point it at the given OID Source Edit
proc setHeadDetached(repo: GitRepository; reference: string): GitResultCode {. ...raises: [Exception, OSError, Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- point the repo's head at the given reference Source Edit
proc shortestTag(table: GitTagTable; oid: string): string {....raises: [], tags: [], forbids: [].}
- pick the shortest tag that matches the oid supplied Source Edit
proc tagCreate(repo: GitRepository; target: GitThing; name: string; tagger: GitSignature; message = ""; force = false): GitResult[ GitOid] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new tag in the repository with signature, message Source Edit
proc tagCreateLightweight(repo: GitRepository; target: GitThing; name: string; force = false): GitResult[GitOid] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- create a new lightweight tag in the repository Source Edit
proc tagDelete(repo: GitRepository; name: string): GitResultCode {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- remove a tag Source Edit
proc tagList(repo: GitRepository): GitResult[seq[string]] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- retrieve a list of tags from the repo Source Edit
proc tagTable(repo: GitRepository): GitResult[GitTagTable] {....raises: [Exception, OSError, ResultError[system.void], ResultError[errors.git_error_code], ValueError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- compose a table of tags and their associated references Source Edit
proc toStrArray(values: openArray[string]): GittyStrArray {....raises: [], tags: [], forbids: [].}
- future converter (?) to nim-alloc'd string array Source Edit
proc toStringSeq(gstrings: GitStrArray | GittyStrArray): seq[string]
- future converter (?) from nim-or-libgit-alloc'd string arrays Source Edit
proc treeEntryByPath(thing: GitThing; path: string): GitResult[GitTreeEntry] {. ...raises: [Exception, OSError, Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- get a tree entry using its path and that of the repo Source Edit
proc treeEntryToThing(repo: GitRepository; entry: GitTreeEntry): GitResult[ GitThing] {....raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- convert a tree entry into a thing Source Edit
proc treeWalk(tree: GitThing; mode = GIT_TREEWALK_PRE): GitResult[GitTreeEntries] {. ...raises: [Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- the laziest way to walk a tree, ever Source Edit
Iterators
iterator branches(repo: GitRepository; flags = {GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE}): GitResult[ GitReference] {....raises: [ValueError, Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- this time, you're just gonna have to guess at what this proc might do... (also, you're just gonna have to free your references...) Source Edit
iterator commitsForSpec(repo: GitRepository; spec: openArray[string]): GitResult[ GitThing] {....raises: [Exception, OSError, ResultError[system.void], ResultError[errors.git_error_code]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- yield each commit that matches the provided pathspec Source Edit
iterator revWalk(repo: GitRepository; walker: GitRevWalker): GitResult[GitThing] {....raises: [ Exception, OSError, ResultError[system.void], ResultError[errors.git_error_code]], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- sic the walker on a repo starting with the given oid Source Edit
iterator status(repository: GitRepository; show: GitStatusShow; flags = defaultStatusFlags): GitResult[GitStatus] {. ...raises: [Exception, OSError, Exception, OSError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect], forbids: [].}
- iterate over files in the repo using the given search flags Source Edit
Templates
template `:=`[T](v: untyped{nkIdent}; vv: Result[T, GitResultCode]; body: untyped): untyped
- Source Edit
template err[T](self: var Result[T, GitResultCode]; x: GitResultCode): auto
- Source Edit
template err[T](x: GitResultCode): auto
- Source Edit
template gitFail(allocd: typed; code: GitResultCode; body: untyped)
- a version of gitTrap that expects failure; no error messages! Source Edit
template gitFail(code: GitResultCode; body: untyped)
- a version of gitTrap that expects failure; no error messages! Source Edit
template gitTrap(allocd: typed; code: GitResultCode; body: untyped)
- trap an api result code, dump it via logging, run the body as an error handler Source Edit
template gitTrap(code: GitResultCode; body: untyped)
- trap an api result code, dump it via logging, run the body as an error handler Source Edit