summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-02 05:21:14 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-02 05:21:14 -0800
commit823bcd6edc7f7330714486b228b052953c2f4229 (patch)
tree27a2c555fb2d97cb79256a26131a36eab2ab265c /combine-diff.c
parentfd4b1d2193640009c9303daa784691fc5e102018 (diff)
downloadgit-823bcd6edc7f7330714486b228b052953c2f4229.tar.gz
combine-diff: fix placement of deletion.
The code misplaced a raw hunk that consists of solely deleted lines by one line. This showed e.g. Len's 12-way octopus (9fdb62af in the linux-2.6), kernel/power/disk.c, hunk starting at line 95, incorrectly. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 8f295c89d0..36363bddac 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -235,7 +235,10 @@ static void combine_diff(const unsigned char *parent, const char *ourtmp,
*/
nb = 1;
}
- lost_bucket = &sline[nb-1]; /* sline is 0 based */
+ if (nn == 0)
+ lost_bucket = &sline[nb];
+ else
+ lost_bucket = &sline[nb-1];
continue;
}
if (!lost_bucket)
@@ -627,6 +630,15 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
else
printf("%s", elem->path);
putchar('\n');
+ printf("index ");
+ for (i = 0; i < num_parent; i++) {
+ printf("%s%s",
+ i ? ".." : "",
+ find_unique_abbrev(elem->parent_sha1[i],
+ DEFAULT_ABBREV));
+ }
+ printf("->%s\n",
+ find_unique_abbrev(elem->sha1, DEFAULT_ABBREV));
dump_sline(sline, cnt, num_parent);
}
if (ourtmp == ourtmp_buf)