Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 7766705

Browse files
committed
combine-diff: lift 32-way limit of combined diff
The "raw" format of combine-diff output is supposed to have as many colons as there are parents at the beginning, then blob modes for these parents, and then object names for these parents. We weren't however prepared to handle a more than 32-way merge and did not show the correct number of colons in such a case. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7e20105 commit 7766705

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

combine-diff.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
982982
free(sline);
983983
}
984984

985-
#define COLONS "::::::::::::::::::::::::::::::::"
986-
987985
static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
988986
{
989987
struct diff_options *opt = &rev->diffopt;
990-
int i, offset;
991-
const char *prefix;
992-
int line_termination, inter_name_termination;
988+
int line_termination, inter_name_termination, i;
993989

994990
line_termination = opt->line_termination;
995991
inter_name_termination = '\t';
@@ -1000,17 +996,14 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
1000996
show_log(rev);
1001997

1002998
if (opt->output_format & DIFF_FORMAT_RAW) {
1003-
offset = strlen(COLONS) - num_parent;
1004-
if (offset < 0)
1005-
offset = 0;
1006-
prefix = COLONS + offset;
999+
/* As many colons as there are parents */
1000+
for (i = 0; i < num_parent; i++)
1001+
putchar(':');
10071002

10081003
/* Show the modes */
1009-
for (i = 0; i < num_parent; i++) {
1010-
printf("%s%06o", prefix, p->parent[i].mode);
1011-
prefix = " ";
1012-
}
1013-
printf("%s%06o", prefix, p->mode);
1004+
for (i = 0; i < num_parent; i++)
1005+
printf("%06o ", p->parent[i].mode);
1006+
printf("%06o", p->mode);
10141007

10151008
/* Show sha1's */
10161009
for (i = 0; i < num_parent; i++)

0 commit comments

Comments
 (0)