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:
current_repo = Git(config.CURRENT_REPO)
for commit in Repository(repo_path).traverse_commits():
...
...
current_repo.checkout(commit_hash)
Which is confusing because this works until we hit a merge commit?