ctucx.git: nimgit

[nimlang] nim-wrapper for libgit2

commit 78ae4557c7a843414f1204239f72598c64f98d1f
parent 6df94530647028cd67cd4fd80f84f56a4dc6a7e6
Author: Leah (ctucx) <leah@ctu.cx>
Date: Wed, 17 Mar 2021 00:01:22 +0100

fix up for new usage
2 files changed, 10 insertions(+), 6 deletions(-)
M
listAllCommits.nim
|
12
++++++++----
M
nimgit.nim
|
4
++--
diff --git a/listAllCommits.nim b/listAllCommits.nim
@@ -8,10 +8,15 @@ if paramCount() == 0:
 discard git_libgit2_init()
 
 try:
-    let gitRepository     = openGitRepository(paramStr(1))
-    let gitRevisionWalker = gitRepository.createRevisionWalker("HEAD")
+    var gitRepository     = openGitRepository(paramStr(1))
+    let gitRevisionWalker = gitRepository.walk()
 
-    for gitOid in gitRevisionWalker.walk():
+    gitRevisionWalker.sort(GIT_SORT_TOPOLOGICAL)
+    gitRevisionWalker.pushHead()
+
+    gitRevisionWalker.simplifyFirstParent()
+
+    for gitOid in gitRevisionWalker:
         let gitCommit = gitRepository.lookupCommit(gitOid)
 
         let author = gitCommit.getAuthor()

@@ -25,7 +30,6 @@ try:
 
         free(gitCommit)
 
-    free(gitRevisionWalker)
     free(gitRepository)
 
 except:
diff --git a/nimgit.nim b/nimgit.nim
@@ -1,6 +1,6 @@
 import nimgit2
-import nimgit/[types, free, repository, objects, reference, commit]
+import nimgit/[types, free, repository, objects, reference, revisionWalker, branch, commit]
 
 export nimgit2
-export types, free, objects, repository, reference, commit
+export types, free, objects, repository, reference, revisionWalker, branch, commit