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>

Junio C Hamano committed Feb 3, 2013 at 13:08 UTC 776670519823b5c49ff4107dc9f77706fa37bb76
1 file changed +7 -14
combine-diff.c
+7 -14
@@ -982,14 +982,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
982 free(sline);
983 }
984
985 -#define COLONS "::::::::::::::::::::::::::::::::"
986 -
985 static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
986 {
987 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;
989
990 line_termination = opt->line_termination;
991 inter_name_termination = '\t';
@@ -1000,17 +996,14 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
996 show_log(rev);
997
998 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(':');
1002
1003 /* 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);
1007
1008 /* Show sha1's */
1009 for (i = 0; i < num_parent; i++)