Merge branch 'jl/submodule-ignore-diff' into next

* jl/submodule-ignore-diff:
  checkout: Use submodule.*.ignore settings from .git/config and .gitmodules
  checkout: Add test for diff.ignoreSubmodules
This commit is contained in:
Junio C Hamano
2010-08-31 13:22:36 -07:00
3 changed files with 30 additions and 1 deletions

View File

@@ -829,7 +829,8 @@ diff.renames::
diff.ignoreSubmodules::
Sets the default value of --ignore-submodules. Note that this
affects only 'git diff' Porcelain, and not lower level 'diff'
commands such as 'git diff-files'.
commands such as 'git diff-files'. 'git checkout' also honors
this setting when reporting uncommitted changes.
diff.suppressBlankEmpty::
A boolean to inhibit the standard behavior of printing a space

View File

@@ -627,6 +627,10 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
handle_ignore_submodules_arg(&opts->diff_options, value);
return 0;
}
if (!prefixcmp(var, "submodule."))
return parse_submodule_config_option(var, value);
return git_xmerge_config(var, value, NULL);
}
@@ -711,6 +715,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
memset(&opts, 0, sizeof(opts));
memset(&new, 0, sizeof(new));
gitmodules_config();
git_config(git_checkout_config, &opts);
opts.track = BRANCH_TRACK_UNSPECIFIED;

View File

@@ -39,4 +39,27 @@ test_expect_success '"checkout <submodule>" updates the index only' '
git diff-files --quiet
'
test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
git config diff.ignoreSubmodules dirty &&
echo x> submodule/untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
'
test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
git config diff.ignoreSubmodules none &&
git config -f .gitmodules submodule.submodule.path submodule &&
git config -f .gitmodules submodule.submodule.ignore untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
'
test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
git config -f .gitmodules submodule.submodule.ignore none &&
git config submodule.submodule.path submodule &&
git config submodule.submodule.ignore all &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
'
test_done