builtin/merge-recursive: make hash independent

Use GIT_MAX_HEXSZ instead of GIT_SHA1_HEXSZ for an allocation so that it is sufficiently large. Switch a comparison to use the_hash_algo to determine the length of a hex object ID. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jul 16, 2018 at 01:28 UTC b7f20f72047f3ec22c7daff61a40f52f85ad0b3a
1 file changed +2 -2
builtin/merge-recursive.c
+2 -2
@@ -9,10 +9,10 @@ static const char builtin_merge_recursive_usage[] =
9
10 static const char *better_branch_name(const char *branch)
11 {
12 - static char githead_env[8 + GIT_SHA1_HEXSZ + 1];
12 + static char githead_env[8 + GIT_MAX_HEXSZ + 1];
13 char *name;
14
15 - if (strlen(branch) != GIT_SHA1_HEXSZ)
15 + if (strlen(branch) != the_hash_algo->hexsz)
16 return branch;
17 xsnprintf(githead_env, sizeof(githead_env), "GITHEAD_%s", branch);
18 name = getenv(githead_env);