Signed-off-by: Stefan Beller <sbel...@google.com>
---
 builtin/diff.c               |  2 ++
 t/t7413-submodule--helper.sh | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/builtin/diff.c b/builtin/diff.c
index 52c98a9..1c6abd5 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -366,6 +366,8 @@ int cmd_diff(int argc, const char **argv, const char 
*prefix)
 
        setup_diff_pager(&rev.diffopt);
 
+       rev.diffopt.submodule_groups = string_list_duplicate(
+               git_config_get_value_multi("submodule.defaultGroup"), 1);
        /*
         * Do we have --cached and not have a pending object, then
         * default to HEAD by hand.  Eek.
diff --git a/t/t7413-submodule--helper.sh b/t/t7413-submodule--helper.sh
index a3dbfea..1ca7878 100755
--- a/t/t7413-submodule--helper.sh
+++ b/t/t7413-submodule--helper.sh
@@ -267,4 +267,19 @@ test_expect_success 'git status respects groups' '
        test_i18ngrep "modified:   sub3" actual
 '
 
+test_expect_success 'git diff respects groups' '
+       # use setup from previous test
+       (
+               cd super_clone &&
+               git config --add submodule.defaultGroup *bit1 &&
+               git config --add submodule.defaultGroup ./sub0 &&
+               git diff >../actual
+               git config --unset-all submodule.defaultGroup
+       ) &&
+       test_i18ngrep "diff --git a/sub0 b/sub0" actual &&
+       test_i18ngrep "diff --git a/sub1 b/sub1" actual &&
+       test_i18ngrep ! "diff --git a/sub2 b/sub2" actual &&
+       test_i18ngrep "diff --git a/sub3 b/sub3" actual
+'
+
 test_done
-- 
2.8.0.41.g8d9aeb3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to