Skip to content

Commit e84bc23

Browse files
bk2204gitster
authored andcommitted
tree-walk: avoid hard-coded 20 constant
Use the_hash_algo to look up the length of our current hash instead of hard-coding the value 20. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 00de606 commit e84bc23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tree-walk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void entry_extract(struct tree_desc *t, struct name_entry *a)
105105
static int update_tree_entry_internal(struct tree_desc *desc, struct strbuf *err)
106106
{
107107
const void *buf = desc->buffer;
108-
const unsigned char *end = desc->entry.oid->hash + 20;
108+
const unsigned char *end = desc->entry.oid->hash + the_hash_algo->rawsz;
109109
unsigned long size = desc->size;
110110
unsigned long len = end - (const unsigned char *)buf;
111111

0 commit comments

Comments
 (0)