I have a yet uncommited branch in git with SHA1 0000000000000000000000000000000000000000 (all zeroes), is this normal or did I corrupt the git repository?
Please don't answer yes there's one in 2^160, or 0.00000000000000000000000000000000000000000000006842277657836021% probabilities to have that SHA1.
I am reasonably safe I'm not the lucky guy who got the SHA1 of 0000000000000000000000000000000000000000 in his git repository.
Note, you can find the "all-zeros SHA1" all the way back to commit f65fdf (June 30th, 2005, v0.99 of git)
Linus Torvalds:
A "old ref" of all zeroes is considered a "don't care" ref, and allows us to say "write the new ref regardless of what the old ref contained (or even if it existed at all)".
This allows (if git-send-pack were to do it) creating new refs, and fixing up old ones.
As SzG mentioned in the comments, this is the kind of SHA1 you find in Git receive/update hooks and new branches, representing an "old-ref" for a non-existent object (while the "new-ref" would create said object, like a branch).
A commit includes, among other metadata, the commit date. So the commit hash can't be displayed until the commit has actually been created. What you're seeing is not a commit SHA, it's just a default value used in the UI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With