Skip to content

Commit 5636a20

Browse files
committed
Merge branch 'bc/submodule-status-ignored'
* bc/submodule-status-ignored: Improve documentation concerning the status.submodulesummary setting submodule: don't print status output with ignore=all submodule: fix confusing variable name
2 parents 80f165a + bb58b69 commit 5636a20

File tree

7 files changed

+55
-11
lines changed

7 files changed

+55
-11
lines changed

Documentation/config.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,7 +2214,14 @@ status.submodulesummary::
22142214
If this is set to a non zero number or true (identical to -1 or an
22152215
unlimited number), the submodule summary will be enabled and a
22162216
summary of commits for modified submodules will be shown (see
2217-
--summary-limit option of linkgit:git-submodule[1]).
2217+
--summary-limit option of linkgit:git-submodule[1]). Please note
2218+
that the summary output command will be suppressed for all
2219+
submodules when `diff.ignoreSubmodules` is set to 'all' or only
2220+
for those submodules where `submodule.<name>.ignore=all`. To
2221+
also view the summary for ignored submodules you can either use
2222+
the --ignore-submodules=dirty command line option or the 'git
2223+
submodule summary' command, which shows a similar output but does
2224+
not honor these settings.
22182225

22192226
submodule.<name>.path::
22202227
submodule.<name>.url::
@@ -2249,7 +2256,8 @@ submodule.<name>.ignore::
22492256
submodules that have untracked files in their work tree as changed.
22502257
This setting overrides any setting made in .gitmodules for this submodule,
22512258
both settings can be overridden on the command line by using the
2252-
"--ignore-submodules" option.
2259+
"--ignore-submodules" option. The 'git submodule' commands are not
2260+
affected by this setting.
22532261

22542262
tar.umask::
22552263
This variable can be used to restrict the permission bits of

Documentation/diff-config.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ diff.ignoreSubmodules::
7373
Sets the default value of --ignore-submodules. Note that this
7474
affects only 'git diff' Porcelain, and not lower level 'diff'
7575
commands such as 'git diff-files'. 'git checkout' also honors
76-
this setting when reporting uncommitted changes.
76+
this setting when reporting uncommitted changes. Setting it to
77+
'all' disables the submodule summary normally shown by 'git commit'
78+
and 'git status' when 'status.submodulesummary' is set unless it is
79+
overridden by using the --ignore-submodules command line option.
80+
The 'git submodule' commands are not affected by this setting.
7781

7882
diff.mnemonicprefix::
7983
If set, 'git diff' uses a prefix pair that is different from the

Documentation/git-status.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,13 @@ directory.
210210
If `status.submodulesummary` is set to a non zero number or true (identical
211211
to -1 or an unlimited number), the submodule summary will be enabled for
212212
the long format and a summary of commits for modified submodules will be
213-
shown (see --summary-limit option of linkgit:git-submodule[1]).
213+
shown (see --summary-limit option of linkgit:git-submodule[1]). Please note
214+
that the summary output from the status command will be suppressed for all
215+
submodules when `diff.ignoreSubmodules` is set to 'all' or only for those
216+
submodules where `submodule.<name>.ignore=all`. To also view the summary for
217+
ignored submodules you can either use the --ignore-submodules=dirty command
218+
line option or the 'git submodule summary' command, which shows a similar
219+
output but does not honor these settings.
214220

215221
SEE ALSO
216222
--------

Documentation/gitmodules.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ submodule.<name>.ignore::
7575
the superproject, the setting there will override the one found in
7676
.gitmodules.
7777
Both settings can be overridden on the command line by using the
78-
"--ignore-submodule" option.
78+
"--ignore-submodule" option. The 'git submodule' commands are not
79+
affected by this setting.
7980

8081

8182
EXAMPLES

git-submodule.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,13 +1032,20 @@ cmd_summary() {
10321032
# Get modified modules cared by user
10331033
modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
10341034
sane_egrep '^:([0-7]* )?160000' |
1035-
while read mod_src mod_dst sha1_src sha1_dst status name
1035+
while read mod_src mod_dst sha1_src sha1_dst status sm_path
10361036
do
10371037
# Always show modules deleted or type-changed (blob<->module)
1038-
test $status = D -o $status = T && echo "$name" && continue
1038+
test $status = D -o $status = T && echo "$sm_path" && continue
1039+
# Respect the ignore setting for --for-status.
1040+
if test -n "$for_status"
1041+
then
1042+
name=$(module_name "$sm_path")
1043+
ignore_config=$(get_submodule_config "$name" ignore none)
1044+
test $status != A -a $ignore_config = all && continue
1045+
fi
10391046
# Also show added or modified modules which are checked out
1040-
GIT_DIR="$name/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
1041-
echo "$name"
1047+
GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
1048+
echo "$sm_path"
10421049
done
10431050
)
10441051

t/t7401-submodule-summary.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ EOF
104104
test_cmp expected actual
105105
"
106106

107+
test_expect_success 'no ignore=all setting has any effect' "
108+
git config -f .gitmodules submodule.sm1.path sm1 &&
109+
git config -f .gitmodules submodule.sm1.ignore all &&
110+
git config submodule.sm1.ignore all &&
111+
git config diff.ignoreSubmodules all &&
112+
git submodule summary >actual &&
113+
cat >expected <<-EOF &&
114+
* sm1 $head1...$head2 (1):
115+
> Add foo3
116+
117+
EOF
118+
test_cmp expected actual &&
119+
git config --unset diff.ignoreSubmodules &&
120+
git config --remove-section submodule.sm1 &&
121+
git config -f .gitmodules --remove-section submodule.sm1
122+
"
123+
124+
107125
commit_file sm1 &&
108126
head3=$(
109127
cd sm1 &&

t/t7508-status.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,15 +1380,15 @@ EOF
13801380
test_i18ncmp expect output
13811381
'
13821382

1383-
test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1383+
test_expect_success '.gitmodules ignore=all suppresses submodule summary' '
13841384
git config --add -f .gitmodules submodule.subname.ignore all &&
13851385
git config --add -f .gitmodules submodule.subname.path sm &&
13861386
git status > output &&
13871387
test_cmp expect output &&
13881388
git config -f .gitmodules --remove-section submodule.subname
13891389
'
13901390

1391-
test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1391+
test_expect_success '.git/config ignore=all suppresses submodule summary' '
13921392
git config --add -f .gitmodules submodule.subname.ignore none &&
13931393
git config --add -f .gitmodules submodule.subname.path sm &&
13941394
git config --add submodule.subname.ignore all &&

0 commit comments

Comments
 (0)