aboutsummaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-27 14:58:48 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-27 14:58:48 -0700
commit0d9c527d5963fca098ea4964f4129511bd5d82d8 (patch)
treefdc63c9e33954d77aa5299e0fb02e1cba49a01cc /sha1_name.c
parentf9db0c055c2f93021ee32a069e15b9e54f39f0da (diff)
parent4f03666ac69ec4799998f010d04916c12e38edf8 (diff)
downloadgit-0d9c527d5963fca098ea4964f4129511bd5d82d8.tar.gz
git-0d9c527d5963fca098ea4964f4129511bd5d82d8.tar.xz
Merge branch 'jk/no-looking-at-dotgit-outside-repo'
Update "git diff --no-index" codepath not to try to peek into .git/ directory that happens to be under the current directory, when we know we are operating outside any repository. * jk/no-looking-at-dotgit-outside-repo: diff: handle sha1 abbreviations outside of repository diff_aligned_abbrev: use "struct oid" diff_unique_abbrev: rename to diff_aligned_abbrev find_unique_abbrev: use 4-buffer ring test-*-cache-tree: setup git dir read info/{attributes,exclude} only when in repository
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index c71fc172f..06409a384 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -508,7 +508,9 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)
const char *find_unique_abbrev(const unsigned char *sha1, int len)
{
- static char hex[GIT_SHA1_HEXSZ + 1];
+ static int bufno;
+ static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
+ char *hex = hexbuffer[3 & ++bufno];
find_unique_abbrev_r(hex, sha1, len);
return hex;
}