#StackBounty: #git #checkout PyDriller – "Reference is not a tree"

Bounty: 50

I am trying to traverse through the commits of a repository.

I am using PyDriller to do so. I initialise the repository as a PyDriller Git repo. I then checkout the PyDriller Git repo at each commit. It works for multiple commits until I try to checkout a merge commit. I receive this error

    git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git checkout -f c9e7ca3de6d9e99cfcc1439a877465e566f452b1
  stderr: 'fatal: reference is not a tree: c9e7ca3de6d9e99cfcc1439a877465e566f452b1'

I can manually checkout this commit using the terminal so I am unsure why it does not work using my python code

The code works like this:

for commit in Repository(repo_path).traverse_commits():

Which is confusing because this works until we hit a merge commit?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.