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 <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2013-02-03 13:08:18 -08:00
Родитель 7e2010537e
Коммит 7766705198
1 изменённых файлов: 7 добавлений и 14 удалений

Просмотреть файл

@ -982,14 +982,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
free(sline); free(sline);
} }
#define COLONS "::::::::::::::::::::::::::::::::"
static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev) static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
{ {
struct diff_options *opt = &rev->diffopt; struct diff_options *opt = &rev->diffopt;
int i, offset; int line_termination, inter_name_termination, i;
const char *prefix;
int line_termination, inter_name_termination;
line_termination = opt->line_termination; line_termination = opt->line_termination;
inter_name_termination = '\t'; inter_name_termination = '\t';
@ -1000,17 +996,14 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
show_log(rev); show_log(rev);
if (opt->output_format & DIFF_FORMAT_RAW) { if (opt->output_format & DIFF_FORMAT_RAW) {
offset = strlen(COLONS) - num_parent; /* As many colons as there are parents */
if (offset < 0) for (i = 0; i < num_parent; i++)
offset = 0; putchar(':');
prefix = COLONS + offset;
/* Show the modes */ /* Show the modes */
for (i = 0; i < num_parent; i++) { for (i = 0; i < num_parent; i++)
printf("%s%06o", prefix, p->parent[i].mode); printf("%06o ", p->parent[i].mode);
prefix = " "; printf("%06o", p->mode);
}
printf("%s%06o", prefix, p->mode);
/* Show sha1's */ /* Show sha1's */
for (i = 0; i < num_parent; i++) for (i = 0; i < num_parent; i++)