Skip to content

Commit

Permalink
combine-diff: lift 32-way limit of combined diff
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Feb 3, 2013
1 parent 7e20105 commit 7766705
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions combine-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,14 +982,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
free(sline);
}

#define COLONS "::::::::::::::::::::::::::::::::"

static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
{
struct diff_options *opt = &rev->diffopt;
int i, offset;
const char *prefix;
int line_termination, inter_name_termination;
int line_termination, inter_name_termination, i;

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

if (opt->output_format & DIFF_FORMAT_RAW) {
offset = strlen(COLONS) - num_parent;
if (offset < 0)
offset = 0;
prefix = COLONS + offset;
/* As many colons as there are parents */
for (i = 0; i < num_parent; i++)
putchar(':');

/* Show the modes */
for (i = 0; i < num_parent; i++) {
printf("%s%06o", prefix, p->parent[i].mode);
prefix = " ";
}
printf("%s%06o", prefix, p->mode);
for (i = 0; i < num_parent; i++)
printf("%06o ", p->parent[i].mode);
printf("%06o", p->mode);

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

0 comments on commit 7766705

Please sign in to comment.