graph: add support for --line-prefix on all graph-aware output

Add an extension to git-diff and git-log (and any other graph-aware displayable output) such that "--line-prefix=<string>" will print the additional line-prefix on every line of output. To make this work, we have to fix a few bugs in the graph API that force graph_show_commit_msg to be used only when you have a valid graph. Additionally, we extend the default_diff_output_prefix handler to work even when no graph is enabled. This is somewhat of a hack on top of the graph API, but I think it should be acceptable here. This will be used by a future extension of submodule display which displays the submodule diff as the actual diff between the pre and post commit in the submodule project. Add some tests for both git-log and git-diff to ensure that the prefix is honored correctly. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jacob Keller committed Aug 31, 2016 at 16:27 UTC 660e113ce11840f4bc4028bff89889e6122fe89a
11 files changed +504 -80
Documentation/diff-options.txt
+3
@@ -569,5 +569,8 @@ endif::git-format-patch[]
569 --no-prefix::
570 Do not show any source or destination prefix.
571
572 +--line-prefix=<prefix>::
573 + Prepend an additional prefix to every line of output.
574 +
575 For more detailed explanation on these common options, see also
576 linkgit:gitdiffcore[7].
builtin/rev-list.c
+33 -41
@@ -122,48 +122,40 @@ static void show_commit(struct commit *commit, void *data)
122 ctx.fmt = revs->commit_format;
123 ctx.output_encoding = get_log_output_encoding();
124 pretty_print_commit(&ctx, commit, &buf);
125 - if (revs->graph) {
126 - if (buf.len) {
127 - if (revs->commit_format != CMIT_FMT_ONELINE)
128 - graph_show_oneline(revs->graph);
129 -
130 - graph_show_commit_msg(revs->graph, &buf);
131 -
132 - /*
133 - * Add a newline after the commit message.
134 - *
135 - * Usually, this newline produces a blank
136 - * padding line between entries, in which case
137 - * we need to add graph padding on this line.
138 - *
139 - * However, the commit message may not end in a
140 - * newline. In this case the newline simply
141 - * ends the last line of the commit message,
142 - * and we don't need any graph output. (This
143 - * always happens with CMIT_FMT_ONELINE, and it
144 - * happens with CMIT_FMT_USERFORMAT when the
145 - * format doesn't explicitly end in a newline.)
146 - */
147 - if (buf.len && buf.buf[buf.len - 1] == '\n')
148 - graph_show_padding(revs->graph);
149 - putchar('\n');
150 - } else {
151 - /*
152 - * If the message buffer is empty, just show
153 - * the rest of the graph output for this
154 - * commit.
155 - */
156 - if (graph_show_remainder(revs->graph))
157 - putchar('\n');
158 - if (revs->commit_format == CMIT_FMT_ONELINE)
159 - putchar('\n');
160 - }
125 + if (buf.len) {
126 + if (revs->commit_format != CMIT_FMT_ONELINE)
127 + graph_show_oneline(revs->graph);
128 +
129 + graph_show_commit_msg(revs->graph, stdout, &buf);
130 +
131 + /*
132 + * Add a newline after the commit message.
133 + *
134 + * Usually, this newline produces a blank
135 + * padding line between entries, in which case
136 + * we need to add graph padding on this line.
137 + *
138 + * However, the commit message may not end in a
139 + * newline. In this case the newline simply
140 + * ends the last line of the commit message,
141 + * and we don't need any graph output. (This
142 + * always happens with CMIT_FMT_ONELINE, and it
143 + * happens with CMIT_FMT_USERFORMAT when the
144 + * format doesn't explicitly end in a newline.)
145 + */
146 + if (buf.len && buf.buf[buf.len - 1] == '\n')
147 + graph_show_padding(revs->graph);
148 + putchar('\n');
149 } else {
162 - if (revs->commit_format != CMIT_FMT_USERFORMAT ||
163 - buf.len) {
164 - fwrite(buf.buf, 1, buf.len, stdout);
165 - putchar(info->hdr_termination);
166 - }
150 + /*
151 + * If the message buffer is empty, just show
152 + * the rest of the graph output for this
153 + * commit.
154 + */
155 + if (graph_show_remainder(revs->graph))
156 + putchar('\n');
157 + if (revs->commit_format == CMIT_FMT_ONELINE)
158 + putchar('\n');
159 }
160 strbuf_release(&buf);
161 } else {
diff.c
+7
@@ -18,6 +18,7 @@
18 #include "ll-merge.h"
19 #include "string-list.h"
20 #include "argv-array.h"
21 +#include "graph.h"
22
23 #ifdef NO_FAST_WORKING_DIRECTORY
24 #define FAST_WORKING_DIRECTORY 0
@@ -3966,6 +3967,12 @@ int diff_opt_parse(struct diff_options *options,
3967 options->a_prefix = optarg;
3968 return argcount;
3969 }
3970 + else if ((argcount = parse_long_opt("line-prefix", av, &optarg))) {
3971 + options->line_prefix = optarg;
3972 + options->line_prefix_length = strlen(options->line_prefix);
3973 + graph_setup_line_prefix(options);
3974 + return argcount;
3975 + }
3976 else if ((argcount = parse_long_opt("dst-prefix", av, &optarg))) {
3977 options->b_prefix = optarg;
3978 return argcount;
diff.h
+2
@@ -115,6 +115,8 @@ struct diff_options {
115 const char *pickaxe;
116 const char *single_follow;
117 const char *a_prefix, *b_prefix;
118 + const char *line_prefix;
119 + size_t line_prefix_length;
120 unsigned flags;
121 unsigned touched_flags;
122
graph.c
+64 -34
@@ -2,7 +2,6 @@
2 #include "commit.h"
3 #include "color.h"
4 #include "graph.h"
5 -#include "diff.h"
5 #include "revision.h"
6
7 /* Internal API */
@@ -28,8 +27,15 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
27 * responsible for printing this line's graph (perhaps via
28 * graph_show_commit() or graph_show_oneline()) before calling
29 * graph_show_strbuf().
30 + *
31 + * Note that unlike some other graph display functions, you must pass the file
32 + * handle directly. It is assumed that this is the same file handle as the
33 + * file specified by the graph diff options. This is necessary so that
34 + * graph_show_strbuf can be called even with a NULL graph.
35 */
32 -static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);
36 +static void graph_show_strbuf(struct git_graph *graph,
37 + FILE *file,
38 + struct strbuf const *sb);
39
40 /*
41 * TODO:
@@ -59,6 +65,17 @@ enum graph_state {
65 GRAPH_COLLAPSING
66 };
67
68 +static void graph_show_line_prefix(const struct diff_options *diffopt)
69 +{
70 + if (!diffopt || !diffopt->line_prefix)
71 + return;
72 +
73 + fwrite(diffopt->line_prefix,
74 + sizeof(char),
75 + diffopt->line_prefix_length,
76 + diffopt->file);
77 +}
78 +
79 static const char **column_colors;
80 static unsigned short column_colors_max;
81
@@ -195,13 +212,28 @@ static struct strbuf *diff_output_prefix_callback(struct diff_options *opt, void
212 static struct strbuf msgbuf = STRBUF_INIT;
213
214 assert(opt);
198 - assert(graph);
215
216 strbuf_reset(&msgbuf);
201 - graph_padding_line(graph, &msgbuf);
217 + if (opt->line_prefix)
218 + strbuf_add(&msgbuf, opt->line_prefix,
219 + opt->line_prefix_length);
220 + if (graph)
221 + graph_padding_line(graph, &msgbuf);
222 return &msgbuf;
223 }
224
225 +static const struct diff_options *default_diffopt;
226 +
227 +void graph_setup_line_prefix(struct diff_options *diffopt)
228 +{
229 + default_diffopt = diffopt;
230 +
231 + /* setup an output prefix callback if necessary */
232 + if (diffopt && !diffopt->output_prefix)
233 + diffopt->output_prefix = diff_output_prefix_callback;
234 +}
235 +
236 +
237 struct git_graph *graph_init(struct rev_info *opt)
238 {
239 struct git_graph *graph = xmalloc(sizeof(struct git_graph));
@@ -1183,6 +1215,8 @@ void graph_show_commit(struct git_graph *graph)
1215 struct strbuf msgbuf = STRBUF_INIT;
1216 int shown_commit_line = 0;
1217
1218 + graph_show_line_prefix(default_diffopt);
1219 +
1220 if (!graph)
1221 return;
1222
@@ -1200,8 +1234,10 @@ void graph_show_commit(struct git_graph *graph)
1234 shown_commit_line = graph_next_line(graph, &msgbuf);
1235 fwrite(msgbuf.buf, sizeof(char), msgbuf.len,
1236 graph->revs->diffopt.file);
1203 - if (!shown_commit_line)
1237 + if (!shown_commit_line) {
1238 putc('\n', graph->revs->diffopt.file);
1239 + graph_show_line_prefix(&graph->revs->diffopt);
1240 + }
1241 strbuf_setlen(&msgbuf, 0);
1242 }
1243
@@ -1212,6 +1248,8 @@ void graph_show_oneline(struct git_graph *graph)
1248 {
1249 struct strbuf msgbuf = STRBUF_INIT;
1250
1251 + graph_show_line_prefix(default_diffopt);
1252 +
1253 if (!graph)
1254 return;
1255
@@ -1224,6 +1262,8 @@ void graph_show_padding(struct git_graph *graph)
1262 {
1263 struct strbuf msgbuf = STRBUF_INIT;
1264
1265 + graph_show_line_prefix(default_diffopt);
1266 +
1267 if (!graph)
1268 return;
1269
@@ -1237,6 +1277,8 @@ int graph_show_remainder(struct git_graph *graph)
1277 struct strbuf msgbuf = STRBUF_INIT;
1278 int shown = 0;
1279
1280 + graph_show_line_prefix(default_diffopt);
1281 +
1282 if (!graph)
1283 return 0;
1284
@@ -1250,27 +1292,24 @@ int graph_show_remainder(struct git_graph *graph)
1292 strbuf_setlen(&msgbuf, 0);
1293 shown = 1;
1294
1253 - if (!graph_is_commit_finished(graph))
1295 + if (!graph_is_commit_finished(graph)) {
1296 putc('\n', graph->revs->diffopt.file);
1255 - else
1297 + graph_show_line_prefix(&graph->revs->diffopt);
1298 + } else {
1299 break;
1300 + }
1301 }
1302 strbuf_release(&msgbuf);
1303
1304 return shown;
1305 }
1306
1263 -
1264 -static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
1307 +static void graph_show_strbuf(struct git_graph *graph,
1308 + FILE *file,
1309 + struct strbuf const *sb)
1310 {
1311 char *p;
1312
1268 - if (!graph) {
1269 - fwrite(sb->buf, sizeof(char), sb->len,
1270 - graph->revs->diffopt.file);
1271 - return;
1272 - }
1273 -
1313 /*
1314 * Print the strbuf line by line,
1315 * and display the graph info before each line but the first.
@@ -1285,7 +1324,7 @@ static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
1324 } else {
1325 len = (sb->buf + sb->len) - p;
1326 }
1288 - fwrite(p, sizeof(char), len, graph->revs->diffopt.file);
1327 + fwrite(p, sizeof(char), len, file);
1328 if (next_p && *next_p != '\0')
1329 graph_show_oneline(graph);
1330 p = next_p;
@@ -1293,29 +1332,20 @@ static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
1332 }
1333
1334 void graph_show_commit_msg(struct git_graph *graph,
1335 + FILE *file,
1336 struct strbuf const *sb)
1337 {
1338 int newline_terminated;
1339
1300 - if (!graph) {
1301 - /*
1302 - * If there's no graph, just print the message buffer.
1303 - *
1304 - * The message buffer for CMIT_FMT_ONELINE and
1305 - * CMIT_FMT_USERFORMAT are already missing a terminating
1306 - * newline. All of the other formats should have it.
1307 - */
1308 - fwrite(sb->buf, sizeof(char), sb->len,
1309 - graph->revs->diffopt.file);
1310 - return;
1311 - }
1312 -
1313 - newline_terminated = (sb->len && sb->buf[sb->len - 1] == '\n');
1314 -
1340 /*
1341 * Show the commit message
1342 */
1318 - graph_show_strbuf(graph, sb);
1343 + graph_show_strbuf(graph, file, sb);
1344 +
1345 + if (!graph)
1346 + return;
1347 +
1348 + newline_terminated = (sb->len && sb->buf[sb->len - 1] == '\n');
1349
1350 /*
1351 * If there is more output needed for this commit, show it now
@@ -1327,7 +1357,7 @@ void graph_show_commit_msg(struct git_graph *graph,
1357 * new line.
1358 */
1359 if (!newline_terminated)
1330 - putc('\n', graph->revs->diffopt.file);
1360 + putc('\n', file);
1361
1362 graph_show_remainder(graph);
1363
@@ -1335,6 +1365,6 @@ void graph_show_commit_msg(struct git_graph *graph,
1365 * If sb ends with a newline, our output should too.
1366 */
1367 if (newline_terminated)
1338 - putc('\n', graph->revs->diffopt.file);
1368 + putc('\n', file);
1369 }
1370 }
graph.h
+21 -1
@@ -1,9 +1,22 @@
1 #ifndef GRAPH_H
2 #define GRAPH_H
3 +#include "diff.h"
4
5 /* A graph is a pointer to this opaque structure */
6 struct git_graph;
7
8 +/*
9 + * Called to setup global display of line_prefix diff option.
10 + *
11 + * Passed a diff_options structure which indicates the line_prefix and the
12 + * file to output the prefix to. This is sort of a hack used so that the
13 + * line_prefix will be honored by all flows which also honor "--graph"
14 + * regardless of whether a graph has actually been setup. The normal graph
15 + * flow will honor the exact diff_options passed, but a NULL graph will cause
16 + * display of a line_prefix to stdout.
17 + */
18 +void graph_setup_line_prefix(struct diff_options *diffopt);
19 +
20 /*
21 * Set up a custom scheme for column colors.
22 *
@@ -113,7 +126,14 @@ int graph_show_remainder(struct git_graph *graph);
126 * missing a terminating newline (including if it is empty), the output
127 * printed by graph_show_commit_msg() will also be missing a terminating
128 * newline.
129 + *
130 + * Note that unlike some other graph display functions, you must pass the file
131 + * handle directly. It is assumed that this is the same file handle as the
132 + * file specified by the graph diff options. This is necessary so that
133 + * graph_show_commit_msg can be called even with a NULL graph.
134 */
117 -void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
135 +void graph_show_commit_msg(struct git_graph *graph,
136 + FILE *file,
137 + struct strbuf const *sb);
138
139 #endif /* GRAPH_H */
log-tree.c
+1 -4
@@ -715,10 +715,7 @@ void show_log(struct rev_info *opt)
715 else
716 opt->missing_newline = 0;
717
718 - if (opt->graph)
719 - graph_show_commit_msg(opt->graph, &msgbuf);
720 - else
721 - fwrite(msgbuf.buf, sizeof(char), msgbuf.len, opt->diffopt.file);
718 + graph_show_commit_msg(opt->graph, opt->diffopt.file, &msgbuf);
719 if (opt->use_terminator && !commit_format_is_empty(opt->commit_format)) {
720 if (!opt->missing_newline)
721 graph_show_padding(opt->graph);
t/t4013-diff-various.sh
+6
@@ -306,6 +306,8 @@ diff --no-index --name-status dir2 dir
306 diff --no-index --name-status -- dir2 dir
307 diff --no-index dir dir3
308 diff master master^ side
309 +# Can't use spaces...
310 +diff --line-prefix=abc master master^ side
311 diff --dirstat master~1 master~2
312 diff --dirstat initial rearrange
313 diff --dirstat-by-file initial rearrange
@@ -325,6 +327,10 @@ test_expect_success 'diff --cached -- file on unborn branch' '
327 git diff --cached -- file0 >result &&
328 test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--cached_--_file0" result
329 '
330 +test_expect_success 'diff --line-prefix with spaces' '
331 + git diff --line-prefix="| | | " --cached -- file0 >result &&
332 + test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--line-prefix_--cached_--_file0" result
333 +'
334
335 test_expect_success 'diff-tree --stdin with log formatting' '
336 cat >expect <<-\EOF &&
t/t4013/diff.diff_--line-prefix=abc_master_master^_side new
+29
@@ -0,0 +1,29 @@
1 +$ git diff --line-prefix=abc master master^ side
2 +abcdiff --cc dir/sub
3 +abcindex cead32e,7289e35..992913c
4 +abc--- a/dir/sub
5 +abc+++ b/dir/sub
6 +abc@@@ -1,6 -1,4 +1,8 @@@
7 +abc A
8 +abc B
9 +abc +C
10 +abc +D
11 +abc +E
12 +abc +F
13 +abc+ 1
14 +abc+ 2
15 +abcdiff --cc file0
16 +abcindex b414108,f4615da..10a8a9f
17 +abc--- a/file0
18 +abc+++ b/file0
19 +abc@@@ -1,6 -1,6 +1,9 @@@
20 +abc 1
21 +abc 2
22 +abc 3
23 +abc +4
24 +abc +5
25 +abc +6
26 +abc+ A
27 +abc+ B
28 +abc+ C
29 +$
t/t4013/diff.diff_--line-prefix_--cached_--_file0 new
+15
@@ -0,0 +1,15 @@
1 +| | | diff --git a/file0 b/file0
2 +| | | new file mode 100644
3 +| | | index 0000000..10a8a9f
4 +| | | --- /dev/null
5 +| | | +++ b/file0
6 +| | | @@ -0,0 +1,9 @@
7 +| | | +1
8 +| | | +2
9 +| | | +3
10 +| | | +4
11 +| | | +5
12 +| | | +6
13 +| | | +A
14 +| | | +B
15 +| | | +C
t/t4202-log.sh
+323
@@ -187,6 +187,16 @@ test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
187 test_cmp expect actual
188 '
189
190 +cat > expect << EOF
191 +=== 804a787 sixth
192 +=== 394ef78 fifth
193 +=== 5d31159 fourth
194 +EOF
195 +test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
196 + git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
197 + test_cmp expect actual
198 +'
199 +
200 cat > expect << EOF
201 5d31159 fourth
202 804a787 sixth
@@ -284,6 +294,21 @@ test_expect_success 'simple log --graph' '
294 test_cmp expect actual
295 '
296
297 +cat > expect <<EOF
298 +123 * Second
299 +123 * sixth
300 +123 * fifth
301 +123 * fourth
302 +123 * third
303 +123 * second
304 +123 * initial
305 +EOF
306 +
307 +test_expect_success 'simple log --graph --line-prefix="123 "' '
308 + git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
309 + test_cmp expect actual
310 +'
311 +
312 test_expect_success 'set up merge history' '
313 git checkout -b side HEAD~4 &&
314 test_commit side-1 1 1 &&
@@ -313,6 +338,27 @@ test_expect_success 'log --graph with merge' '
338 test_cmp expect actual
339 '
340
341 +cat > expect <<\EOF
342 +| | | * Merge branch 'side'
343 +| | | |\
344 +| | | | * side-2
345 +| | | | * side-1
346 +| | | * | Second
347 +| | | * | sixth
348 +| | | * | fifth
349 +| | | * | fourth
350 +| | | |/
351 +| | | * third
352 +| | | * second
353 +| | | * initial
354 +EOF
355 +
356 +test_expect_success 'log --graph --line-prefix="| | | " with merge' '
357 + git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
358 + sed "s/ *\$//" >actual &&
359 + test_cmp expect actual
360 +'
361 +
362 test_expect_success 'log --raw --graph -m with merge' '
363 git log --raw --graph --oneline -m master | head -n 500 >actual &&
364 grep "initial" actual
@@ -867,6 +913,283 @@ test_expect_success 'log --graph with diff and stats' '
913 test_i18ncmp expect actual.sanitized
914 '
915
916 +cat >expect <<\EOF
917 +*** * commit COMMIT_OBJECT_NAME
918 +*** |\ Merge: MERGE_PARENTS
919 +*** | | Author: A U Thor <author@example.com>
920 +*** | |
921 +*** | | Merge HEADS DESCRIPTION
922 +*** | |
923 +*** | * commit COMMIT_OBJECT_NAME
924 +*** | | Author: A U Thor <author@example.com>
925 +*** | |
926 +*** | | reach
927 +*** | | ---
928 +*** | | reach.t | 1 +
929 +*** | | 1 file changed, 1 insertion(+)
930 +*** | |
931 +*** | | diff --git a/reach.t b/reach.t
932 +*** | | new file mode 100644
933 +*** | | index 0000000..10c9591
934 +*** | | --- /dev/null
935 +*** | | +++ b/reach.t
936 +*** | | @@ -0,0 +1 @@
937 +*** | | +reach
938 +*** | |
939 +*** | \
940 +*** *-. \ commit COMMIT_OBJECT_NAME
941 +*** |\ \ \ Merge: MERGE_PARENTS
942 +*** | | | | Author: A U Thor <author@example.com>
943 +*** | | | |
944 +*** | | | | Merge HEADS DESCRIPTION
945 +*** | | | |
946 +*** | | * | commit COMMIT_OBJECT_NAME
947 +*** | | |/ Author: A U Thor <author@example.com>
948 +*** | | |
949 +*** | | | octopus-b
950 +*** | | | ---
951 +*** | | | octopus-b.t | 1 +
952 +*** | | | 1 file changed, 1 insertion(+)
953 +*** | | |
954 +*** | | | diff --git a/octopus-b.t b/octopus-b.t
955 +*** | | | new file mode 100644
956 +*** | | | index 0000000..d5fcad0
957 +*** | | | --- /dev/null
958 +*** | | | +++ b/octopus-b.t
959 +*** | | | @@ -0,0 +1 @@
960 +*** | | | +octopus-b
961 +*** | | |
962 +*** | * | commit COMMIT_OBJECT_NAME
963 +*** | |/ Author: A U Thor <author@example.com>
964 +*** | |
965 +*** | | octopus-a
966 +*** | | ---
967 +*** | | octopus-a.t | 1 +
968 +*** | | 1 file changed, 1 insertion(+)
969 +*** | |
970 +*** | | diff --git a/octopus-a.t b/octopus-a.t
971 +*** | | new file mode 100644
972 +*** | | index 0000000..11ee015
973 +*** | | --- /dev/null
974 +*** | | +++ b/octopus-a.t
975 +*** | | @@ -0,0 +1 @@
976 +*** | | +octopus-a
977 +*** | |
978 +*** * | commit COMMIT_OBJECT_NAME
979 +*** |/ Author: A U Thor <author@example.com>
980 +*** |
981 +*** | seventh
982 +*** | ---
983 +*** | seventh.t | 1 +
984 +*** | 1 file changed, 1 insertion(+)
985 +*** |
986 +*** | diff --git a/seventh.t b/seventh.t
987 +*** | new file mode 100644
988 +*** | index 0000000..9744ffc
989 +*** | --- /dev/null
990 +*** | +++ b/seventh.t
991 +*** | @@ -0,0 +1 @@
992 +*** | +seventh
993 +*** |
994 +*** * commit COMMIT_OBJECT_NAME
995 +*** |\ Merge: MERGE_PARENTS
996 +*** | | Author: A U Thor <author@example.com>
997 +*** | |
998 +*** | | Merge branch 'tangle'
999 +*** | |
1000 +*** | * commit COMMIT_OBJECT_NAME
1001 +*** | |\ Merge: MERGE_PARENTS
1002 +*** | | | Author: A U Thor <author@example.com>
1003 +*** | | |
1004 +*** | | | Merge branch 'side' (early part) into tangle
1005 +*** | | |
1006 +*** | * | commit COMMIT_OBJECT_NAME
1007 +*** | |\ \ Merge: MERGE_PARENTS
1008 +*** | | | | Author: A U Thor <author@example.com>
1009 +*** | | | |
1010 +*** | | | | Merge branch 'master' (early part) into tangle
1011 +*** | | | |
1012 +*** | * | | commit COMMIT_OBJECT_NAME
1013 +*** | | | | Author: A U Thor <author@example.com>
1014 +*** | | | |
1015 +*** | | | | tangle-a
1016 +*** | | | | ---
1017 +*** | | | | tangle-a | 1 +
1018 +*** | | | | 1 file changed, 1 insertion(+)
1019 +*** | | | |
1020 +*** | | | | diff --git a/tangle-a b/tangle-a
1021 +*** | | | | new file mode 100644
1022 +*** | | | | index 0000000..7898192
1023 +*** | | | | --- /dev/null
1024 +*** | | | | +++ b/tangle-a
1025 +*** | | | | @@ -0,0 +1 @@
1026 +*** | | | | +a
1027 +*** | | | |
1028 +*** * | | | commit COMMIT_OBJECT_NAME
1029 +*** |\ \ \ \ Merge: MERGE_PARENTS
1030 +*** | | | | | Author: A U Thor <author@example.com>
1031 +*** | | | | |
1032 +*** | | | | | Merge branch 'side'
1033 +*** | | | | |
1034 +*** | * | | | commit COMMIT_OBJECT_NAME
1035 +*** | | |_|/ Author: A U Thor <author@example.com>
1036 +*** | |/| |
1037 +*** | | | | side-2
1038 +*** | | | | ---
1039 +*** | | | | 2 | 1 +
1040 +*** | | | | 1 file changed, 1 insertion(+)
1041 +*** | | | |
1042 +*** | | | | diff --git a/2 b/2
1043 +*** | | | | new file mode 100644
1044 +*** | | | | index 0000000..0cfbf08
1045 +*** | | | | --- /dev/null
1046 +*** | | | | +++ b/2
1047 +*** | | | | @@ -0,0 +1 @@
1048 +*** | | | | +2
1049 +*** | | | |
1050 +*** | * | | commit COMMIT_OBJECT_NAME
1051 +*** | | | | Author: A U Thor <author@example.com>
1052 +*** | | | |
1053 +*** | | | | side-1
1054 +*** | | | | ---
1055 +*** | | | | 1 | 1 +
1056 +*** | | | | 1 file changed, 1 insertion(+)
1057 +*** | | | |
1058 +*** | | | | diff --git a/1 b/1
1059 +*** | | | | new file mode 100644
1060 +*** | | | | index 0000000..d00491f
1061 +*** | | | | --- /dev/null
1062 +*** | | | | +++ b/1
1063 +*** | | | | @@ -0,0 +1 @@
1064 +*** | | | | +1
1065 +*** | | | |
1066 +*** * | | | commit COMMIT_OBJECT_NAME
1067 +*** | | | | Author: A U Thor <author@example.com>
1068 +*** | | | |
1069 +*** | | | | Second
1070 +*** | | | | ---
1071 +*** | | | | one | 1 +
1072 +*** | | | | 1 file changed, 1 insertion(+)
1073 +*** | | | |
1074 +*** | | | | diff --git a/one b/one
1075 +*** | | | | new file mode 100644
1076 +*** | | | | index 0000000..9a33383
1077 +*** | | | | --- /dev/null
1078 +*** | | | | +++ b/one
1079 +*** | | | | @@ -0,0 +1 @@
1080 +*** | | | | +case
1081 +*** | | | |
1082 +*** * | | | commit COMMIT_OBJECT_NAME
1083 +*** | |_|/ Author: A U Thor <author@example.com>
1084 +*** |/| |
1085 +*** | | | sixth
1086 +*** | | | ---
1087 +*** | | | a/two | 1 -
1088 +*** | | | 1 file changed, 1 deletion(-)
1089 +*** | | |
1090 +*** | | | diff --git a/a/two b/a/two
1091 +*** | | | deleted file mode 100644
1092 +*** | | | index 9245af5..0000000
1093 +*** | | | --- a/a/two
1094 +*** | | | +++ /dev/null
1095 +*** | | | @@ -1 +0,0 @@
1096 +*** | | | -ni
1097 +*** | | |
1098 +*** * | | commit COMMIT_OBJECT_NAME
1099 +*** | | | Author: A U Thor <author@example.com>
1100 +*** | | |
1101 +*** | | | fifth
1102 +*** | | | ---
1103 +*** | | | a/two | 1 +
1104 +*** | | | 1 file changed, 1 insertion(+)
1105 +*** | | |
1106 +*** | | | diff --git a/a/two b/a/two
1107 +*** | | | new file mode 100644
1108 +*** | | | index 0000000..9245af5
1109 +*** | | | --- /dev/null
1110 +*** | | | +++ b/a/two
1111 +*** | | | @@ -0,0 +1 @@
1112 +*** | | | +ni
1113 +*** | | |
1114 +*** * | | commit COMMIT_OBJECT_NAME
1115 +*** |/ / Author: A U Thor <author@example.com>
1116 +*** | |
1117 +*** | | fourth
1118 +*** | | ---
1119 +*** | | ein | 1 +
1120 +*** | | 1 file changed, 1 insertion(+)
1121 +*** | |
1122 +*** | | diff --git a/ein b/ein
1123 +*** | | new file mode 100644
1124 +*** | | index 0000000..9d7e69f
1125 +*** | | --- /dev/null
1126 +*** | | +++ b/ein
1127 +*** | | @@ -0,0 +1 @@
1128 +*** | | +ichi
1129 +*** | |
1130 +*** * | commit COMMIT_OBJECT_NAME
1131 +*** |/ Author: A U Thor <author@example.com>
1132 +*** |
1133 +*** | third
1134 +*** | ---
1135 +*** | ichi | 1 +
1136 +*** | one | 1 -
1137 +*** | 2 files changed, 1 insertion(+), 1 deletion(-)
1138 +*** |
1139 +*** | diff --git a/ichi b/ichi
1140 +*** | new file mode 100644
1141 +*** | index 0000000..9d7e69f
1142 +*** | --- /dev/null
1143 +*** | +++ b/ichi
1144 +*** | @@ -0,0 +1 @@
1145 +*** | +ichi
1146 +*** | diff --git a/one b/one
1147 +*** | deleted file mode 100644
1148 +*** | index 9d7e69f..0000000
1149 +*** | --- a/one
1150 +*** | +++ /dev/null
1151 +*** | @@ -1 +0,0 @@
1152 +*** | -ichi
1153 +*** |
1154 +*** * commit COMMIT_OBJECT_NAME
1155 +*** | Author: A U Thor <author@example.com>
1156 +*** |
1157 +*** | second
1158 +*** | ---
1159 +*** | one | 2 +-
1160 +*** | 1 file changed, 1 insertion(+), 1 deletion(-)
1161 +*** |
1162 +*** | diff --git a/one b/one
1163 +*** | index 5626abf..9d7e69f 100644
1164 +*** | --- a/one
1165 +*** | +++ b/one
1166 +*** | @@ -1 +1 @@
1167 +*** | -one
1168 +*** | +ichi
1169 +*** |
1170 +*** * commit COMMIT_OBJECT_NAME
1171 +*** Author: A U Thor <author@example.com>
1172 +***
1173 +*** initial
1174 +*** ---
1175 +*** one | 1 +
1176 +*** 1 file changed, 1 insertion(+)
1177 +***
1178 +*** diff --git a/one b/one
1179 +*** new file mode 100644
1180 +*** index 0000000..5626abf
1181 +*** --- /dev/null
1182 +*** +++ b/one
1183 +*** @@ -0,0 +1 @@
1184 +*** +one
1185 +EOF
1186 +
1187 +test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1188 + git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1189 + sanitize_output >actual.sanitized <actual &&
1190 + test_i18ncmp expect actual.sanitized
1191 +'
1192 +
1193 test_expect_success 'dotdot is a parent directory' '
1194 mkdir -p a/b &&
1195 ( echo sixth && echo fifth ) >expect &&