go-git-http
go-git-http copied to clipboard
(Event).Commit has value of "HEAD" instead of SHA-1
Thanks for this awesome library! I wish it would get more attention and more stars because it is definitely helping us out a lot at Sourcegraph lately.
I was hoping you could guide me on what the issue could be, because sometimes in my post-push hooks I receive events that have Commit set to "HEAD" and it is causing me some issues (documentation says it should be the SHA-1).
Would you be able to provide some pointers as to why this happens and how it could be fixed?
@AaronO I kept investigating this in the git documentation for receive-pack and can't find the situation where the commit ID would have a value of HEAD. Shouldn't this be resolved automatically to the correct SHA-1? Some guidance here would be helpful.
@gbbr Sorry I missed your first message. I'm happy to hear that it's useful to you at Sourcegraph !
We use this extensively at GitBook, along with a lot of other git related stuff I built. (This component is just a small part of our production git server)
I'm happy to fix this, do you think you can provide with a repo with your hooks, so that I have something to test against ?
No problem! Thanks for getting back to me. That's exactly the issue - I don't know when that happens or how to reproduce it, but I can see in some of our logs that the reason is Commit having value of HEAD and not an SHA-1. I've found a workaround for now and it seems to be ok. Although, I'm not sure if this behavior is normal. I'm glad to hear you guys are also using it and thanks for sharing!
Sorry for not being able to provide a good test case. If I ever run into this again and figure out why it happens, I'll be happy to start a PR :)