Refactor dirty submodule detection in diff-lib.c
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 381cc8d4fd69ca31fb8fc8af31422160e3ec1fd3..240401b73d1161f38e1a6951711c653f1f75267f 100644 (file)
--- 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;