Hacker News new | ask | show | jobs
by pwdisswordfish 3386 days ago
struct object_id was introduced in this commit, in 2015:

https://git.kernel.org/pub/scm/git/git.git/commit/?id=5f7817...

So this change doesn't do much for now. Good to see, though.

1 comments

Yes, this is correct. The struct object_id changes don't actually change the hash. What they do, however, is allow us to remove a lot of the hard-coded instances of 20 and 40 (SHA-1 length in bytes and hex, respectively) in the codebase.

The remaining instances of those values become constants or variables (which I'm also doing as part of the series), and it then becomes much easier to add a new hash function, since we've enumerated all the places we need to update (and can do so with a simple sed one-liner).

The biggest impediment to adding a new hash function has been dealing with the hard-coded constants everywhere.

Says something about quality of the codebase.