summaryrefslogtreecommitdiff
path: root/range-diff.c
diff options
context:
space:
mode:
authorPhilippe Blain <levraiphilippeblain@gmail.com>2022-06-06 20:59:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-06-06 22:47:01 (GMT)
commit04b1f1fd9d9faeb90d7bd25d8eb4d3ffbb28b9f1 (patch)
treee54efd7b7b977c8fc23a798320c4c27232516301 /range-diff.c
parent2668e3608e47494f2f10ef2b6e69f08a84816bcb (diff)
downloadgit-04b1f1fd9d9faeb90d7bd25d8eb4d3ffbb28b9f1.zip
git-04b1f1fd9d9faeb90d7bd25d8eb4d3ffbb28b9f1.tar.gz
git-04b1f1fd9d9faeb90d7bd25d8eb4d3ffbb28b9f1.tar.bz2
range-diff: show submodule changes irrespective of diff.submodule
After generating diffs for each range to be compared using a 'git log' invocation, range-diff.c::read_patches looks for the "diff --git" header in those diffs to recognize the beginning of a new change. In a project with submodules, and with 'diff.submodule=log' set in the config, this header is missing for the diff of a changed submodule, so any submodule changes are quietly ignored in the range-diff. When 'diff.submodule=diff' is set in the config, the "diff --git" header is also missing for the submodule itself, but is shown for submodule content changes, which can easily confuse 'git range-diff' and lead to errors such as: error: git apply: bad git-diff - inconsistent old filename on line 1 error: could not parse git header 'diff --git path/to/submodule/and/some/file/within ' error: could not parse log for '@{u}..@{1}' Force the submodule diff format to its default ("short") when invoking 'git log' to generate the patches for each range, such that submodule changes are always detected. Add a test, including an invocation with '--creation-factor=100' to force the second commit in the range not to be considered a complete rewrite, in order to verify we do indeed get the "short" format. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'range-diff.c')
-rw-r--r--range-diff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/range-diff.c b/range-diff.c
index b72eb9f..068bf21 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -44,7 +44,7 @@ static int read_patches(const char *range, struct string_list *list,
strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
"--reverse", "--date-order", "--decorate=no",
- "--no-prefix",
+ "--no-prefix", "--submodule=short",
/*
* Choose indicators that are not used anywhere
* else in diffs, but still look reasonable