diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2018-05-02 00:25:46 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-02 13:59:51 +0900 |
commit | 5d9e19824573782a9d4461b49bcd78b5faa79963 (patch) | |
tree | b3d5a8ad68452b6ae10bd10a5d055e61b6c1aaba /builtin | |
parent | pack-redundant: convert linked lists to use struct object_id (diff) | |
download | tgif-5d9e19824573782a9d4461b49bcd78b5faa79963.tar.xz |
index-pack: abstract away hash function constant
The code for reading certain pack v2 offsets had a hard-coded 5
representing the number of uint32_t words that we needed to skip over.
Specify this value in terms of a value from the_hash_algo.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/index-pack.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c index d81473e722..c1f94a7da6 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1543,12 +1543,13 @@ static void read_v2_anomalous_offsets(struct packed_git *p, { const uint32_t *idx1, *idx2; uint32_t i; + const uint32_t hashwords = the_hash_algo->rawsz / sizeof(uint32_t); /* The address of the 4-byte offset table */ idx1 = (((const uint32_t *)p->index_data) + 2 /* 8-byte header */ + 256 /* fan out */ - + 5 * p->num_objects /* 20-byte SHA-1 table */ + + hashwords * p->num_objects /* object ID table */ + p->num_objects /* CRC32 table */ ); |