summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-01 12:58:49 -0700
committerJunio C Hamano <gitster@pobox.com>2016-11-01 12:58:49 -0700
commite828d33316925a50ed88e83b840daef2f98b4171 (patch)
treec778bdf4413d745f2f70041953397e39978778be
parentbcb442521663534eb4ad7b57fbf18f9229ced9ba (diff)
parent3e98919a188e36f34c1a20e23ecf2ff1f5da75c9 (diff)
downloadgit-e828d33316925a50ed88e83b840daef2f98b4171.tar.gz
Merge branch 'jk/no-looking-at-dotgit-outside-repo'
A small code cleanup. * jk/no-looking-at-dotgit-outside-repo: sha1_name: make wraparound of the index into ring-buffer explicit
-rw-r--r--sha1_name.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 06409a3845..73a915ff1b 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -510,7 +510,8 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
{
static int bufno;
static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
- char *hex = hexbuffer[3 & ++bufno];
+ char *hex = hexbuffer[bufno];
+ bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer);
find_unique_abbrev_r(hex, sha1, len);
return hex;
}