From: Junio C Hamano Date: Thu, 14 Feb 2013 18:29:59 +0000 (-0800) Subject: Merge branch 'jk/diff-graph-cleanup' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a1d68bea891118bdaecb6dd77610e6daf2f7d53d;p=git.git Merge branch 'jk/diff-graph-cleanup' Refactors a lot of repetitive code sequence from the graph drawing code and adds it to the combined diff output. * jk/diff-graph-cleanup: combine-diff.c: teach combined diffs about line prefix diff.c: use diff_line_prefix() where applicable diff: add diff_line_prefix function diff.c: make constant string arguments const diff: write prefix to the correct file graph: output padding for merge subsequent parents --- a1d68bea891118bdaecb6dd77610e6daf2f7d53d diff --cc combine-diff.c index 7f6187f9c,35c817bb2..35d41cd56 --- a/combine-diff.c +++ b/combine-diff.c @@@ -985,7 -992,12 +992,8 @@@ static void show_patch_diff(struct comb 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; + const char *line_prefix = diff_line_prefix(opt); line_termination = opt->line_termination; inter_name_termination = '\t'; @@@ -995,15 -1007,19 +1003,18 @@@ if (rev->loginfo && !rev->no_commit_id) show_log(rev); ++ if (opt->output_format & DIFF_FORMAT_RAW) { + printf("%s", line_prefix); - 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++)