ctucx.git: nimgit

[nimlang] nim-wrapper for libgit2

commit 7f42361c0a6ed5b6839dd16f066a6ec18419e4c4
parent c0619aee3e1d02b37b23657f65196dcac95b302d
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 18 Mar 2021 00:28:13 +0100

update implemented.txt and examples
3 files changed, 53 insertions(+), 3 deletions(-)
M
implemented.txt
|
41
++++++++++++++++++++++++++++++++++++++++-
M
listAllCommits.nim
|
3
++-
M
showLastCommit.nim
|
12
+++++++++++-
diff --git a/implemented.txt b/implemented.txt
@@ -1,6 +1,16 @@
 
 file                   nim proc                       libgit2 function
 ===============================================================================
+blob.nim               lookupBlob                     git_blob_lookup
+blob.nim               id                             git_blob_id
+blob.nim               owner                          git_blob_owner
+blob.nim               content                        git_blob_rawcontent
+blob.nim               size                           git_blob_rawsize
+blob.nim               isBinary                       git_blob_is_binary
+Missing: git_blob_lookup_prefix, git_blob_filter_options_init, git_blob_filter,
+git_blob_create_from_*, git_blob_dup, git_blob_filtered_content
+
+
 branch.nim             isLocalBranch                  git_reference_is_branch
 branch.nim             isRemoteBranch                 git_reference_is_remote
 branch.nim             isHead                         git_branch_is_head

@@ -53,6 +63,7 @@ free.nim               free                           git_diff_free
 free.nim               free                           git_buf_dispose
 free.nim               free                           git_branch_iterator_free
 free.nim               free                           git_signature_free
+free.nim               free                           git_blob_free
 
 oid.nim                initGitObjectId
 oid.nim                fromString                     git_oid_fromstr

@@ -63,7 +74,8 @@ oid.nim                isZero                         git_oid_is_zero
 
 objects.nim            lookupObjectIdByName           git_reference_name_to_id
 objects.nim            lookupObject                   git_revparse_single
-objects.nim            kind                           git_object_type
+objects.nim            type                           git_object_type
+objects.nim            shortId                        git_object_short_id
 
 reference.nim          getName                        git_reference_name
 reference.nim          getShortName                   git_reference_shorthand

@@ -102,4 +114,31 @@ revisionWalker.nim     simplifyFirstParent            git_revwalk_simplify_first
 revisionWalker.nim     reset                          git_revwalk_reset
 revisionWalker.nim     items                          git_revwalk_next
 
+tag.nim                lookupTag                      git_tag_lookup
+tag.nim                owner                          git_tag_owner
+tag.nim                id                             git_tag_id
+tag.nim                name                           git_tag_name
+tag.nim                message                        git_tag_message
+tag.nim                tagger                         git_tag_tagger
+tag.nim                target                         git_tag_target
+tag.nim                targetId                       git_tag_target_id
+tag.nim                peelTarget                     git_tag_peel
+tag.nim                targetType                     git_tag_target_type
+Missing: git_tag_lookup_prefix, git_tag_create, git_tag_annotation_create, 
+git_tag_create_from_buffer, git_tag_create_lightweight, git_tag_delete, git_tag_list_match
+git_tag_foreach, git_tag_dup, git_tag_name_is_valid
+
+tree.nim               lookupTree                     git_tree_lookup
+tree.nim               owner                          git_tree_owner
+tree.nim               id                             git_tree_id
+tree.nim               len                            git_tree_entrycount
+tree.nim               entry                          git_tree_entry_byindex
+tree.nim               entry                          git_tree_entry_byid
+tree.nim               entry                          git_tree_entry_byname
+tree.nim               entry                          git_tree_entry_bypath
 
+treeEntry.nim          type                           git_tree_entry_type
+treeEntry.nim          id                             git_tree_entry_id
+treeEntry.nim          name                           git_tree_entry_name
+treeEntry.nim          mode                           git_tree_entry_filemode
+treeEntry.nim          object                         git_tree_entry_to_object
diff --git a/listAllCommits.nim b/listAllCommits.nim
@@ -23,6 +23,7 @@ try:
           committer    = commit.committer
           parentCount  = commit.parentCount
           signature    = commit.gpgSignature
+          tree         = commit.tree
 
         echo "==================="
         echo "hash: " & $gitOid

@@ -41,7 +42,7 @@ try:
 
         echo ""
 
-
+        free(tree)
         free(commit)
 
     free(gitRepository)
diff --git a/showLastCommit.nim b/showLastCommit.nim
@@ -16,10 +16,11 @@ try:
       committer     = commit.committer
       parentCount   = commit.parentCount
       signature     = commit.gpgSignature
+      tree          = commit.tree
 
     echo "Last commit on HEAD in repo: " & $gitRepository
     echo "==================="
-    echo "hash: " & $objId
+    echo "hash: " & $objId & " (" & commit.shortId & ")"
     echo "committer: " & committer.name & " <" & committer.email & ">"
     echo "author: " & author.name & " <" & author.email & ">"
     echo "when: " & $commit.time

@@ -35,7 +36,16 @@ try:
 
     echo ""
 
+    echo "tree:"
+    echo "========="
+    for entry in tree:
+      if entry.type == goTree:
+        for entry in tree:
+          echo $entry.id & " " & $entry.mode & " " & $entry.type & " " & entry.name
+      else:
+        echo $entry.id & " " & $entry.mode & " " & $entry.type & " " & entry.name
 
+    free(tree)
     free(commit)
     free(gitRepository)