mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
cd48dadb8d
commit
660e113ce1
29
t/t4013/diff.diff_--line-prefix=abc_master_master^_side
Normal file
29
t/t4013/diff.diff_--line-prefix=abc_master_master^_side
Normal file
@@ -0,0 +1,29 @@
|
||||
$ git diff --line-prefix=abc master master^ side
|
||||
abcdiff --cc dir/sub
|
||||
abcindex cead32e,7289e35..992913c
|
||||
abc--- a/dir/sub
|
||||
abc+++ b/dir/sub
|
||||
abc@@@ -1,6 -1,4 +1,8 @@@
|
||||
abc A
|
||||
abc B
|
||||
abc +C
|
||||
abc +D
|
||||
abc +E
|
||||
abc +F
|
||||
abc+ 1
|
||||
abc+ 2
|
||||
abcdiff --cc file0
|
||||
abcindex b414108,f4615da..10a8a9f
|
||||
abc--- a/file0
|
||||
abc+++ b/file0
|
||||
abc@@@ -1,6 -1,6 +1,9 @@@
|
||||
abc 1
|
||||
abc 2
|
||||
abc 3
|
||||
abc +4
|
||||
abc +5
|
||||
abc +6
|
||||
abc+ A
|
||||
abc+ B
|
||||
abc+ C
|
||||
$
|
||||
15
t/t4013/diff.diff_--line-prefix_--cached_--_file0
Normal file
15
t/t4013/diff.diff_--line-prefix_--cached_--_file0
Normal file
@@ -0,0 +1,15 @@
|
||||
| | | diff --git a/file0 b/file0
|
||||
| | | new file mode 100644
|
||||
| | | index 0000000..10a8a9f
|
||||
| | | --- /dev/null
|
||||
| | | +++ b/file0
|
||||
| | | @@ -0,0 +1,9 @@
|
||||
| | | +1
|
||||
| | | +2
|
||||
| | | +3
|
||||
| | | +4
|
||||
| | | +5
|
||||
| | | +6
|
||||
| | | +A
|
||||
| | | +B
|
||||
| | | +C
|
||||
Reference in New Issue
Block a user