git commit doesn’t commit? (GitPython bug)

Mostly posting this to remind myself of the fix the next time I run into this but htis might help some other people as well.

Every once in a while I’ll be working on a git repo in the fedora packages repository and when I git commit -a it, I’ll end up with an empty commit and the files with changes aren’t actually committed. Other intuitive variations of this like git add FILE && git commit have the same buggy behaviour.

The reason this is occurring has something to do with the GitPython library which is used by fedpkg to add some changes to your clone of the git repo when you add new source files. It’s somehow changing the index in a way that causes this behaviour. To get out of this there’s a few simple but non-intuitive things you can try:

git reset FILE && git add FILE

git stash && git stash pop

After running one of those pairs of commands you should once more be able to git commit -a.

Details in this GitPython bug report


2 thoughts on “git commit doesn’t commit? (GitPython bug)

  1. This one has been annoying me for a long time, but I never managed to figure it out. Thanks a lot for debugging it. 🙂

    In the meantime, I’ve just trained myself to always “git reset .gitignore sources” after a “fedpkg new-source” (because that’s where I get a 100% reproducer).

    One thing that worries me a bit is how GitPython doesn’t really seem to be maintained upstream.

    There are 3 pages of opened bugs and pull requests upstream.

    I opened an fd/memory leak a year and a half ago, and although upstream acknowledged it as critical, and I tried really hard to explicitly pinpoint the actual problem, nothing happened. 😦

    I’m starting to wonder if it wouldn’t be a good idea to move pyrpkg to pygit2 (based on libgit2) at some point. :-/

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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