From 660e113ce11840f4bc4028bff89889e6122fe89a Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Wed, 31 Aug 2016 16:27:20 -0700 Subject: 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=" 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 Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Documentation') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 705a873942..cc4342e203 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -569,5 +569,8 @@ endif::git-format-patch[] --no-prefix:: Do not show any source or destination prefix. +--line-prefix=:: + Prepend an additional prefix to every line of output. + For more detailed explanation on these common options, see also linkgit:gitdiffcore[7]. -- cgit v1.2.3 From fd47ae6a5b9cc0cfc56c1f7c43db612d26ca4b75 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Wed, 31 Aug 2016 16:27:25 -0700 Subject: diff: teach diff to display submodule difference with an inline diff Teach git-diff and friends a new format for displaying the difference of a submodule. The new format is an inline diff of the contents of the submodule between the commit range of the update. This allows the user to see the actual code change caused by a submodule update. Add tests for the new format and option. Signed-off-by: Jacob Keller Signed-off-by: Junio C Hamano --- Documentation/diff-config.txt | 9 +++++---- Documentation/diff-options.txt | 17 ++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'Documentation') diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt index d5a5b17d50..0eded24034 100644 --- a/Documentation/diff-config.txt +++ b/Documentation/diff-config.txt @@ -122,10 +122,11 @@ diff.suppressBlankEmpty:: diff.submodule:: Specify the format in which differences in submodules are - shown. The "log" format lists the commits in the range like - linkgit:git-submodule[1] `summary` does. The "short" format - format just shows the names of the commits at the beginning - and end of the range. Defaults to short. + shown. The "short" format just shows the names of the commits + at the beginning and end of the range. The "log" format lists + the commits in the range like linkgit:git-submodule[1] `summary` + does. The "diff" format shows an inline diff of the changed + contents of the submodule. Defaults to "short". diff.wordRegex:: A POSIX Extended Regular Expression used to determine what is a "word" diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index cc4342e203..7805a0ccad 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -210,13 +210,16 @@ any of those replacements occurred. of the `--diff-filter` option on what the status letters mean. --submodule[=]:: - Specify how differences in submodules are shown. When `--submodule` - or `--submodule=log` is given, the 'log' format is used. This format lists - the commits in the range like linkgit:git-submodule[1] `summary` does. - Omitting the `--submodule` option or specifying `--submodule=short`, - uses the 'short' format. This format just shows the names of the commits - at the beginning and end of the range. Can be tweaked via the - `diff.submodule` configuration variable. + Specify how differences in submodules are shown. When specifying + `--submodule=short` the 'short' format is used. This format just + shows the names of the commits at the beginning and end of the range. + When `--submodule` or `--submodule=log` is specified, the 'log' + format is used. This format lists the commits in the range like + linkgit:git-submodule[1] `summary` does. When `--submodule=diff` + is specified, the 'diff' format is used. This format shows an + inline diff of the changes in the submodule contents between the + commit range. Defaults to `diff.submodule` or the 'short' format + if the config option is unset. --color[=]:: Show colored diff. -- cgit v1.2.3