summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-17 18:28:18 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-17 18:28:18 +0100
commitc22c4349210773c5efc8a076b2e123d00f233c48 (patch)
treedc747be69073295d2feb73a6c02dcfcd0525a59c
parentb84069a736b112dc50f1a371d890e9c1003f1ac7 (diff)
downloadnimgit-c22c4349210773c5efc8a076b2e123d00f233c48.tar.gz
nimgit-c22c4349210773c5efc8a076b2e123d00f233c48.tar.bz2
nimgit-c22c4349210773c5efc8a076b2e123d00f233c48.zip
update implemented.txt and examples
-rw-r--r--implemented.txt8
-rw-r--r--listAllCommits.nim28
-rw-r--r--showLastCommit.nim16
3 files changed, 34 insertions, 18 deletions
diff --git a/implemented.txt b/implemented.txt
index 9da20ad..20e45ef 100644
--- a/implemented.txt
+++ b/implemented.txt
@@ -10,9 +10,17 @@ branch.nim branches git_branch_iterator_new
branch.nim branches git_branch_next
commit.nim lookupCommit git_commit_lookup
+commit.nim owner git_commit_owner
+commit.nim repo (alias) git_commit_owner
+commit.nim rawHeader git_commit_raw_header
commit.nim summary git_commit_summary
commit.nim body git_commit_body
commit.nim message git_commit_message
+commit.nim messageEncoding git_commit_message_encoding
+commit.nim rawMessage git_commit_message_raw
+commit.nim gpgSignature git_commit_extract_signature
+commit.nim time git_commit_time
+commit.nim time git_commit_time_offset
commit.nim objectId git_commit_id
commit.nim author git_commit_author
commit.nim committer git_commit_committer
diff --git a/listAllCommits.nim b/listAllCommits.nim
index 2dbb0e0..1d44877 100644
--- a/listAllCommits.nim
+++ b/listAllCommits.nim
@@ -18,27 +18,31 @@ try:
for gitOid in gitRevisionWalker:
let
- gitCommit = gitRepository.lookupCommit(gitOid)
- author = gitCommit.author
- committer = gitCommit.committer
- parentCount = gitCommit.parentCount
+ commit = gitRepository.lookupCommit(gitOid)
+ author = commit.author
+ committer = commit.committer
+ parentCount = commit.parentCount
+ signature = commit.gpgSignature
echo "==================="
echo "hash: " & $gitOid
echo "committer: " & committer.name & " <" & committer.email & ">"
echo "author: " & author.name & " <" & author.email & ">"
- echo "when: " & $author.when.time
- echo "message: " & gitCommit.summary
+ echo "when: " & $commit.time
+ echo "message: " & commit.summary
+ echo "tree id: " & $commit.treeId
echo "parentCount: " & $parentCount
- var id = 0
- if parentCount > 0:
- while id < parentCount:
- echo "parent: " & $gitCommit.parentId(id)
- inc(id)
+ for parentId in commit.parentIds:
+ echo "parent: " & $parentId
+
+ if signature[0] != "":
+ echo "signature: " & $signature
+
echo ""
- free(gitCommit)
+
+ free(commit)
free(gitRepository)
diff --git a/showLastCommit.nim b/showLastCommit.nim
index 78f3a73..11427a5 100644
--- a/showLastCommit.nim
+++ b/showLastCommit.nim
@@ -15,23 +15,27 @@ try:
author = commit.author
committer = commit.committer
parentCount = commit.parentCount
+ signature = commit.gpgSignature
echo "Last commit on HEAD in repo: " & $gitRepository
echo "==================="
echo "hash: " & $objId
echo "committer: " & committer.name & " <" & committer.email & ">"
echo "author: " & author.name & " <" & author.email & ">"
- echo "when: " & $author.when.time
+ echo "when: " & $commit.time
echo "message: " & commit.summary
+ echo "tree id: " & $commit.treeId
echo "parentCount: " & $parentCount
- var id = 0
- if parentCount > 0:
- while id < parentCount:
- echo "parent: " & $commit.parentId(id)
- inc(id)
+ for parentId in commit.parentIds:
+ echo "parent: " & $parentId
+
+ if signature[0] != "":
+ echo "signature: " & $signature
+
echo ""
+
free(commit)
free(gitRepository)