pygit2
pygit2 copied to clipboard
git-show does not work for initial commits
docs at https://www.pygit2.org/recipes/git-show.html suggest to diff against parent to get diff show contents. For initial commits, there are not parents, thus raising IndexError
If the commit has no parents, diff its tree against an empty tree.
if not commit.parents:
diff = commit.tree.diff_to_tree(swap=True)
@jorio It will be helpful to have this in the documentation as well. Could you please add ?