diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-10 01:51:12 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-10 01:51:12 -0800 |
commit | 297a1aadbe22c978dca60d6512e5c851ebc6688c (patch) | |
tree | 496caac78acc8110d035162cc74b782f980ffd4d /diff.c | |
parent | 0a798076b8d1a4a31bf2b24c564e2a99fd1c43a1 (diff) | |
download | git-297a1aadbe22c978dca60d6512e5c851ebc6688c.tar.gz git-297a1aadbe22c978dca60d6512e5c851ebc6688c.tar.xz |
find_unique_abbrev() simplification.
Earlier it did not grok the 0{40} SHA1 very well, but what it
needed to do was to find the shortest 0{N} that is not used as a
valid object name to be consistent with the way names of valid
objects are abbreviated. This makes some users simpler.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -963,7 +963,7 @@ void diff_free_filepair(struct diff_filepair *p) } /* This is different from find_unique_abbrev() in that - * it needs to deal with 0{40} SHA1. + * it stuffs the result with dots for alignment. */ const char *diff_unique_abbrev(const unsigned char *sha1, int len) { @@ -973,16 +973,8 @@ const char *diff_unique_abbrev(const unsigned char *sha1, int len) return sha1_to_hex(sha1); abbrev = find_unique_abbrev(sha1, len); - if (!abbrev) { - if (!memcmp(sha1, null_sha1, 20)) { - char *buf = sha1_to_hex(null_sha1); - if (len < 37) - strcpy(buf + len, "..."); - return buf; - } - else - return sha1_to_hex(sha1); - } + if (!abbrev) + return sha1_to_hex(sha1); abblen = strlen(abbrev); if (abblen < 37) { static char hex[41]; |