summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-17 11:34:59 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-17 11:34:59 +0100
commitb8cb5804a1c271f1e3615649ca699c5b4d2367ac (patch)
treea51670fa50a041d8aef775b17c8fbe2c9656e3f4
parente389a36cbcfc305f19a45fd7e51ace0bc43d2a77 (diff)
downloadnimgit-b8cb5804a1c271f1e3615649ca699c5b4d2367ac.tar.gz
nimgit-b8cb5804a1c271f1e3615649ca699c5b4d2367ac.tar.bz2
nimgit-b8cb5804a1c271f1e3615649ca699c5b4d2367ac.zip
commit.nim: rename procs, new proc treeId
-rw-r--r--nimgit/commit.nim27
1 files changed, 15 insertions, 12 deletions
diff --git a/nimgit/commit.nim b/nimgit/commit.nim
index 2be6a8f..c7158b5 100644
--- a/nimgit/commit.nim
+++ b/nimgit/commit.nim
@@ -9,25 +9,25 @@ proc lookupCommit* (repo: GitRepository, oid: GitObjectId): GitCommit =
raise newException(CatchableError, "Commit lookup failed: " & $error.getResultCode)
-proc getObjectId* (commit: GitCommit): GitObjectId = git_commit_id(commit)
+proc objectId* (commit: GitCommit): GitObjectId = git_commit_id(commit)
-proc `$`* (commit: GitCommit): string = $commit.getObjectId()
+proc `$`* (commit: GitCommit): string = $commit.objectId()
-proc getSummary* (commit: GitCommit): string = $git_commit_summary(commit)
+proc summary* (commit: GitCommit): string = $git_commit_summary(commit)
-proc getMessage* (commit: GitCommit): string = $git_commit_message(commit)
+proc body* (commit: GitCommit): string = $git_commit_body(commit)
-proc getShortMessage* (commit: GitCommit): string = commit.getSummary()
+proc message* (commit: GitCommit): string = $git_commit_message(commit)
-proc getAuthor* (commit: GitCommit): GitSignature =
+proc author* (commit: GitCommit): GitSignature =
let author = git_commit_author(commit)
result.name = $author.name
result.email = $author.email
result.when = parseGitTime(author.when)
-proc getCommitter* (commit: GitCommit): GitSignature =
+proc committer* (commit: GitCommit): GitSignature =
let author = git_commit_committer(commit)
result.name = $author.name
@@ -35,19 +35,22 @@ proc getCommitter* (commit: GitCommit): GitSignature =
result.when = parseGitTime(author.when)
-proc getParrentCount* (commit: GitCommit): int = cast[int](git_commit_parentcount(commit))
+proc hasParents* (commit: GitCommit): bool = cast[bool](git_commit_parentcount(commit))
-proc getParrentId* (commit: GitCommit): GitObjectId = git_commit_parent_id(commit, 0)
+proc parentCount* (commit: GitCommit): int = cast[int](git_commit_parentcount(commit))
-proc getParrent* (commit: GitCommit): GitCommit =
- let error = git_commit_parent(addr result, commit, 0)
+proc parentId* (commit: GitCommit, id: int = 0): GitObjectId = git_commit_parent_id(commit, cuint(id))
+
+proc parent* (commit: GitCommit, id: int = 0): GitCommit =
+ let error = git_commit_parent(addr result, commit, cuint(id))
if error != 0:
free(result)
raise newException(CatchableError, "parrent lookup failed: " & $error.getResultCode)
+proc treeId* (commit: GitCommit): GitObjectId = git_commit_tree_id(commit)
-proc getTree* (commit: GitCommit): GitTree =
+proc tree* (commit: GitCommit): GitTree =
let error = git_commit_tree(addr result, commit)
if error != 0: