]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sha1_name.c
diff: handle sha1 abbreviations outside of repository
[thirdparty/git.git] / sha1_name.c
index 409283614679b625f1cb6d191f1a2a32423bbcda..36ce9b9f45041c6e17e763cee259c284312dc42c 100644 (file)
@@ -472,7 +472,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;
 }