import os import nimgit if paramCount() == 0: echo "No git-repo given." quit(QuitFailure) discard git_libgit2_init() try: let gitRepository = openGitRepository(paramStr(1)) config = gitRepository.config objId = gitRepository.lookupObjectIdByName("HEAD") commit = gitRepository.lookupCommit(objId) tree = commit.tree echo "Tree of last commit on HEAD in repo: " & $gitRepository echo "=========================================================" for element in tree.walk: let (path, entry) = element echo $entry.id & " " & entry.modeStr & " " & $entry.type & " " & path & entry.name free(entry) echo "" free(tree) free(commit) free(config) free(gitRepository) except: echo "Error:\n", getCurrentExceptionMsg()