summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-03-11 21:50:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-13 06:17:17 (GMT)
commitae6d5c1b6f78ef48f606e5a267915fa31b37a679 (patch)
treea996130e95e7b8406148b630b0ad6ba998b47ca4 /diff.c
parent9297f77e6d350f33de961e149dc33c77e7392db4 (diff)
downloadgit-ae6d5c1b6f78ef48f606e5a267915fa31b37a679.zip
git-ae6d5c1b6f78ef48f606e5a267915fa31b37a679.tar.gz
git-ae6d5c1b6f78ef48f606e5a267915fa31b37a679.tar.bz2
Refactor dirty submodule detection in diff-lib.c
Moving duplicated code into the new function match_stat_with_submodule(). Replacing the implicit activation of detailed checks for the dirtiness of submodules when DIFF_FORMAT_PATCH was selected with explicitly setting the recently added DIFF_OPT_DIRTY_SUBMODULES option in diff_setup_done(). Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 381cc8d..240401b 100644
--- a/diff.c
+++ b/diff.c
@@ -2628,6 +2628,12 @@ int diff_setup_done(struct diff_options *options)
*/
if (options->pickaxe)
DIFF_OPT_SET(options, RECURSIVE);
+ /*
+ * When patches are generated, submodules diffed against the work tree
+ * must be checked for dirtiness too so it can be shown in the output
+ */
+ if (options->output_format & DIFF_FORMAT_PATCH)
+ DIFF_OPT_SET(options, DIRTY_SUBMODULES);
if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;