@matheusbsbs / matheus-bagliano / commits / 823bcd6edc
Fork 0

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>

Junio C Hamano committed Feb 2, 2006 at 05:21 UTC 823bcd6edc7f7330714486b228b052953c2f4229
1 file changed +13 -1
combine-diff.c
+13 -1
@@ -235,7 +235,10 @@ static void combine_diff(const unsigned char *parent, const char *ourtmp,
235 */
236 nb = 1;
237 }
238 - lost_bucket = &sline[nb-1]; /* sline is 0 based */
238 + if (nn == 0)
239 + lost_bucket = &sline[nb];
240 + else
241 + lost_bucket = &sline[nb-1];
242 continue;
243 }
244 if (!lost_bucket)
@@ -627,6 +630,15 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
630 else
631 printf("%s", elem->path);
632 putchar('\n');
633 + printf("index ");
634 + for (i = 0; i < num_parent; i++) {
635 + printf("%s%s",
636 + i ? ".." : "",
637 + find_unique_abbrev(elem->parent_sha1[i],
638 + DEFAULT_ABBREV));
639 + }
640 + printf("->%s\n",
641 + find_unique_abbrev(elem->sha1, DEFAULT_ABBREV));
642 dump_sline(sline, cnt, num_parent);
643 }
644 if (ourtmp == ourtmp_buf)