@matheusbsbs / matheus-bagliano / commits / f7a3d33f0f
Fork 0

combine-diff: finishing touches to git-diff-tree --cc

This updates the output format to make administrative lines more consistent with the traditional diffs. The "index" line shows blob object names from each parents (separated by commas), double dots and the object name of the resulting blob. The hunk header line begins with N+1 '@' characters for N-way diff, the line number L of the first line in the hunk and line count C from the parent in "-L,C" format for each parents and then the line number of the first line in the hunk and line count from the resulting file in "+L,C" format, and finally N+1 '@' characters (earlier versions had the line numbers from the resulting file at the beginning). Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 2, 2006 at 17:43 UTC f7a3d33f0f93eba4db61819b289df76a32d61b1b
1 file changed +4 -4
combine-diff.c
+4 -4
@@ -528,7 +528,7 @@ static void show_parent_lno(struct sline *sline, unsigned long l0, unsigned long
528 {
529 l0 = sline[l0].p_lno[n];
530 l1 = sline[l1].p_lno[n];
531 - printf("-%lu,%lu ", l0, l1-l0);
531 + printf(" -%lu,%lu", l0, l1-l0);
532 }
533
534 static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent)
@@ -548,9 +548,9 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent)
548 if (!(sline[hunk_end].flag & mark))
549 break;
550 for (i = 0; i <= num_parent; i++) putchar(combine_marker);
551 - printf(" +%lu,%lu ", lno+1, hunk_end-lno);
551 for (i = 0; i < num_parent; i++)
552 show_parent_lno(sline, lno, hunk_end, cnt, i);
553 + printf(" +%lu,%lu ", lno+1, hunk_end-lno);
554 for (i = 0; i <= num_parent; i++) putchar(combine_marker);
555 putchar('\n');
556 while (lno < hunk_end) {
@@ -714,11 +714,11 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
714 printf("index ");
715 for (i = 0; i < num_parent; i++) {
716 printf("%s%s",
717 - i ? ".." : "",
717 + i ? "," : "",
718 find_unique_abbrev(elem->parent_sha1[i],
719 DEFAULT_ABBREV));
720 }
721 - printf("->%s\n",
721 + printf("..%s\n",
722 find_unique_abbrev(elem->sha1, DEFAULT_ABBREV));
723 dump_sline(sline, cnt, num_parent);
724 }