summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 960c702)
raw | patch | inline | side by side (parent: 960c702)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 6 Feb 2006 20:30:00 +0000 (12:30 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 6 Feb 2006 20:30:00 +0000 (12:30 -0800) |
When we run combined diff from working tree (diff-files --cc),
we sent NULL to printf that is returned by find_unique_abbrev().
Signed-off-by: Junio C Hamano <junkio@cox.net>
we sent NULL to printf that is returned by find_unique_abbrev().
Signed-off-by: Junio C Hamano <junkio@cox.net>
combine-diff.c | patch | blob | history |
diff --git a/combine-diff.c b/combine-diff.c
index 250de1c629e14bde19c2f011982d64d8ea16288d..50db39b852683b7568e850d138cff72b2e835992 100644 (file)
--- a/combine-diff.c
+++ b/combine-diff.c
write_to_temp_file(ourtmp, result, size);
}
else {
+ /* Used by diff-tree to read from the working tree */
struct stat st;
int fd;
ourtmp = elem->path;
show_hunks = make_hunks(sline, cnt, num_parent, dense);
if (show_hunks) {
+ 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);
putchar('\n');
printf("index ");
for (i = 0; i < num_parent; i++) {
- printf("%s%s",
- i ? "," : "",
- find_unique_abbrev(elem->parent_sha1[i],
- DEFAULT_ABBREV));
+ if (memcmp(elem->parent_sha1[i], null_sha1, 20))
+ abb = find_unique_abbrev(elem->parent_sha1[i],
+ DEFAULT_ABBREV);
+ else
+ abb = null_abb;
+ printf("%s%s", i ? "," : "", abb);
}
- printf("..%s\n",
- find_unique_abbrev(elem->sha1, DEFAULT_ABBREV));
+ if (memcmp(elem->sha1, null_sha1, 20))
+ abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
+ else
+ abb = null_abb;
+ printf("..%s\n", abb);
dump_sline(sline, cnt, num_parent);
}
if (ourtmp == ourtmp_buf)