aboutsummaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-10 01:51:12 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-10 01:51:12 -0800
commit297a1aadbe22c978dca60d6512e5c851ebc6688c (patch)
tree496caac78acc8110d035162cc74b782f980ffd4d /combine-diff.c
parent0a798076b8d1a4a31bf2b24c564e2a99fd1c43a1 (diff)
downloadgit-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 'combine-diff.c')
-rw-r--r--combine-diff.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 9aa099b06..8ba694920 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -716,10 +716,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
if (show_hunks || mode_differs) {
const char *abb;
- char null_abb[DEFAULT_ABBREV + 1];
- memset(null_abb, '0', DEFAULT_ABBREV);
- null_abb[DEFAULT_ABBREV] = 0;
if (header) {
shown_header++;
puts(header);
@@ -734,17 +731,11 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
for (i = 0; i < num_parent; i++) {
if (elem->parent[i].mode != elem->mode)
mode_differs = 1;
- if (memcmp(elem->parent[i].sha1, null_sha1, 20))
- abb = find_unique_abbrev(elem->parent[i].sha1,
- DEFAULT_ABBREV);
- else
- abb = null_abb;
+ abb = find_unique_abbrev(elem->parent[i].sha1,
+ DEFAULT_ABBREV);
printf("%s%s", i ? "," : "", abb);
}
- if (memcmp(elem->sha1, null_sha1, 20))
- abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
- else
- abb = null_abb;
+ abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
printf("..%s\n", abb);
if (mode_differs) {