diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-11-01 12:58:49 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-11-01 12:58:49 -0700 |
commit | e828d33316925a50ed88e83b840daef2f98b4171 (patch) | |
tree | c778bdf4413d745f2f70041953397e39978778be /sha1_name.c | |
parent | bcb442521663534eb4ad7b57fbf18f9229ced9ba (diff) | |
parent | 3e98919a188e36f34c1a20e23ecf2ff1f5da75c9 (diff) | |
download | git-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
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 3 |
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; } |