Skip to content

Commit e828d33

Browse files
committed
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
2 parents bcb4425 + 3e98919 commit e828d33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sha1_name.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
510510
{
511511
static int bufno;
512512
static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
513-
char *hex = hexbuffer[3 & ++bufno];
513+
char *hex = hexbuffer[bufno];
514+
bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer);
514515
find_unique_abbrev_r(hex, sha1, len);
515516
return hex;
516517
}

0 commit comments

Comments
 (0)