notes-merge: switch to use the_hash_algo

Switch from using GIT_SHA1_HEXSZ to GIT_MAX_HEXSZ and the_hash_algo so that the code works with any hash algorithm. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Feb 19, 2019 at 00:05 UTC 22350307550c8503ef1738f911cabba63c3a4901
1 file changed +3 -3
notes-merge.c
+3 -3
@@ -29,14 +29,14 @@ void init_notes_merge_options(struct repository *r,
29
30 static int path_to_oid(const char *path, struct object_id *oid)
31 {
32 - char hex_oid[GIT_SHA1_HEXSZ];
32 + char hex_oid[GIT_MAX_HEXSZ];
33 int i = 0;
34 - while (*path && i < GIT_SHA1_HEXSZ) {
34 + while (*path && i < the_hash_algo->hexsz) {
35 if (*path != '/')
36 hex_oid[i++] = *path;
37 path++;
38 }
39 - if (*path || i != GIT_SHA1_HEXSZ)
39 + if (*path || i != the_hash_algo->hexsz)
40 return -1;
41 return get_oid_hex(hex_oid, oid);
42 }