range-diff: indent the diffs just like tbdiff

The main information in the `range-diff` view comes from the list of matching and non-matching commits, the diffs are additional information. Indenting them helps with the reading flow. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Aug 13, 2018 at 04:33 UTC 5e242e63d0e9955a37268cc6b93b4e8fdedde07f
1 file changed +10
builtin/range-diff.c
+10
@@ -11,6 +11,11 @@ N_("git range-diff [<options>] <base> <old-tip> <new-tip>"),
11 NULL
12 };
13
14 +static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)
15 +{
16 + return data;
17 +}
18 +
19 int cmd_range_diff(int argc, const char **argv, const char *prefix)
20 {
21 int creation_factor = 60;
@@ -21,12 +26,16 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
26 OPT_END()
27 };
28 int i, j, res = 0;
29 + struct strbuf four_spaces = STRBUF_INIT;
30 struct strbuf range1 = STRBUF_INIT, range2 = STRBUF_INIT;
31
32 git_config(git_diff_ui_config, NULL);
33
34 diff_setup(&diffopt);
35 diffopt.output_format = DIFF_FORMAT_PATCH;
36 + diffopt.output_prefix = output_prefix_cb;
37 + strbuf_addstr(&four_spaces, " ");
38 + diffopt.output_prefix_data = &four_spaces;
39
40 argc = parse_options(argc, argv, NULL, options,
41 builtin_range_diff_usage, PARSE_OPT_KEEP_UNKNOWN |
@@ -90,6 +99,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
99
100 strbuf_release(&range1);
101 strbuf_release(&range2);
102 + strbuf_release(&four_spaces);
103
104 return res;
105 }