summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-03-26 16:01:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-27 05:08:21 (GMT)
commitdc01505f7f272a44b974e622f75bd592debe9dcb (patch)
tree7aa62babd604067a3d928edfa988391711a36007 /bisect.c
parent5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3 (diff)
downloadgit-dc01505f7f272a44b974e622f75bd592debe9dcb.zip
git-dc01505f7f272a44b974e622f75bd592debe9dcb.tar.gz
git-dc01505f7f272a44b974e622f75bd592debe9dcb.tar.bz2
Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ
Since we will likely be introducing a new hash function at some point, and that hash function might be longer than 40 hex characters, use the constant GIT_MAX_HEXSZ, which is designed to be suitable for allocations, instead of GIT_SHA1_HEXSZ. This will ease the transition down the line by distinguishing between places where we need to allocate memory suitable for the largest hash from those where we need to handle the current hash. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bisect.c b/bisect.c
index 30808ca..21c3e34 100644
--- a/bisect.c
+++ b/bisect.c
@@ -682,7 +682,7 @@ static int is_expected_rev(const struct object_id *oid)
static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)
{
- char bisect_rev_hex[GIT_SHA1_HEXSZ + 1];
+ char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
memcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);