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>
brian m. carlson committed
May 2, 2018 at 00:25 UTC
e84bc23cb69209c771abd4fe098773340a850c48
1 file changed
+1
-1
tree-walk.c
+1
-1
@@ -105,7 +105,7 @@ static void entry_extract(struct tree_desc *t, struct name_entry *a)
105
static int update_tree_entry_internal(struct tree_desc *desc, struct strbuf *err)
106
{
107
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;
109
unsigned long size = desc->size;
110
unsigned long len = end - (const unsigned char *)buf;
111