@matheusbsbs / matheus-bagliano / commits / 23b4c7bcc5
Fork 0

checkout: Use submodule.*.ignore settings from .git/config and .gitmodules

For "git status" and the diff family the submodule.*.ignore settings from .git/config and .gitmodules can be used to override the default set via diff.ignoreSubmodules on a per-submodule basis. Let's do this consistently and teach checkout to use these settings too. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Aug 28, 2010 at 16:50 UTC 23b4c7bcc58431beaf9c870a2d6b2ad4fb088a9f
2 files changed +21
builtin/checkout.c
+5
@@ -608,6 +608,10 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
608 handle_ignore_submodules_arg(&opts->diff_options, value);
609 return 0;
610 }
611 +
612 + if (!prefixcmp(var, "submodule."))
613 + return parse_submodule_config_option(var, value);
614 +
615 return git_xmerge_config(var, value, NULL);
616 }
617
@@ -689,6 +693,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
693 memset(&opts, 0, sizeof(opts));
694 memset(&new, 0, sizeof(new));
695
696 + gitmodules_config();
697 git_config(git_checkout_config, &opts);
698
699 opts.track = BRANCH_TRACK_UNSPECIFIED;
t/t2013-checkout-submodule.sh
+16
@@ -46,4 +46,20 @@ test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
46 ! test -s actual
47 '
48
49 +test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
50 + git config diff.ignoreSubmodules none &&
51 + git config -f .gitmodules submodule.submodule.path submodule &&
52 + git config -f .gitmodules submodule.submodule.ignore untracked &&
53 + git checkout HEAD >actual 2>&1 &&
54 + ! test -s actual
55 +'
56 +
57 +test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
58 + git config -f .gitmodules submodule.submodule.ignore none &&
59 + git config submodule.submodule.path submodule &&
60 + git config submodule.submodule.ignore all &&
61 + git checkout HEAD >actual 2>&1 &&
62 + ! test -s actual
63 +'
64 +
65 test_done