Code

Merge branch 'jk/maint-1.7.2-status-ignored' into maint
[git.git] / t / t7508-status.sh
index 4856f9eeeaad1d0ffbf88b9371e664edf557119f..905255adf0ca5b15d9befa772cda4a650bd15f34 100755 (executable)
@@ -7,6 +7,30 @@ test_description='git status'
 
 . ./test-lib.sh
 
+test_expect_success 'status -h in broken repository' '
+       mkdir broken &&
+       test_when_finished "rm -fr broken" &&
+       (
+               cd broken &&
+               git init &&
+               echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
+               test_expect_code 129 git status -h >usage 2>&1
+       ) &&
+       test_i18ngrep "[Uu]sage" broken/usage
+'
+
+test_expect_success 'commit -h in broken repository' '
+       mkdir broken &&
+       test_when_finished "rm -fr broken" &&
+       (
+               cd broken &&
+               git init &&
+               echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
+               test_expect_code 129 git commit -h >usage 2>&1
+       ) &&
+       test_i18ngrep "[Uu]sage" broken/usage
+'
+
 test_expect_success 'setup' '
        : >tracked &&
        : >modified &&
@@ -32,9 +56,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'status (1)' '
-
-       grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
-
+       test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
 '
 
 cat >expect <<\EOF
@@ -44,7 +66,7 @@ cat >expect <<\EOF
 #
 #      new file:   dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -62,9 +84,32 @@ cat >expect <<\EOF
 EOF
 
 test_expect_success 'status (2)' '
+       git status >output &&
+       test_i18ncmp expect output
+'
 
+cat >expect <<\EOF
+# On branch master
+# Changes to be committed:
+#      new file:   dir2/added
+#
+# Changes not staged for commit:
+#      modified:   dir1/modified
+#
+# Untracked files:
+#      dir1/untracked
+#      dir2/modified
+#      dir2/untracked
+#      expect
+#      output
+#      untracked
+EOF
+
+test_expect_success 'status (advice.statusHints false)' '
+       test_when_finished "git config --unset advice.statusHints" &&
+       git config advice.statusHints false &&
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
@@ -79,7 +124,7 @@ A  dir2/added
 ?? untracked
 EOF
 
-test_expect_success 'status -s (2)' '
+test_expect_success 'status -s' '
 
        git status -s >output &&
        test_cmp expect output
@@ -123,7 +168,7 @@ test_expect_success 'status with gitignore' '
        #
        #       new file:   dir2/added
        #
-       # Changed but not updated:
+       # Changes not staged for commit:
        #   (use "git add <file>..." to update what will be committed)
        #   (use "git checkout -- <file>..." to discard changes in working directory)
        #
@@ -184,7 +229,7 @@ test_expect_success 'status with gitignore (nothing untracked)' '
        #
        #       new file:   dir2/added
        #
-       # Changed but not updated:
+       # Changes not staged for commit:
        #   (use "git add <file>..." to update what will be committed)
        #   (use "git checkout -- <file>..." to discard changes in working directory)
        #
@@ -207,6 +252,31 @@ test_expect_success 'status with gitignore (nothing untracked)' '
 
 rm -f .gitignore
 
+cat >expect <<\EOF
+## master
+ M dir1/modified
+A  dir2/added
+?? dir1/untracked
+?? dir2/modified
+?? dir2/untracked
+?? expect
+?? output
+?? untracked
+EOF
+
+test_expect_success 'status -s -b' '
+
+       git status -s -b >output &&
+       test_cmp expect output
+
+'
+
+test_expect_success 'setup dir3' '
+       mkdir dir3 &&
+       : >dir3/untracked1 &&
+       : >dir3/untracked2
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -214,7 +284,7 @@ cat >expect <<EOF
 #
 #      new file:   dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -223,25 +293,39 @@ cat >expect <<EOF
 # Untracked files not listed (use -u option to show untracked files)
 EOF
 test_expect_success 'status -uno' '
-       mkdir dir3 &&
-       : >dir3/untracked1 &&
-       : >dir3/untracked2 &&
        git status -uno >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 test_expect_success 'status (status.showUntrackedFiles no)' '
        git config status.showuntrackedfiles no
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
+'
+
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+#      new file:   dir2/added
+#
+# Changes not staged for commit:
+#      modified:   dir1/modified
+#
+# Untracked files not listed
+EOF
+git config advice.statusHints false
+test_expect_success 'status -uno (advice.statusHints false)' '
+       git status -uno >output &&
+       test_i18ncmp expect output
 '
+git config --unset advice.statusHints
 
 cat >expect << EOF
  M dir1/modified
 A  dir2/added
 EOF
 test_expect_success 'status -s -uno' '
-       git config --unset status.showuntrackedfiles
        git status -s -uno >output &&
        test_cmp expect output
 '
@@ -259,7 +343,7 @@ cat >expect <<EOF
 #
 #      new file:   dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -278,13 +362,14 @@ cat >expect <<EOF
 EOF
 test_expect_success 'status -unormal' '
        git status -unormal >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 test_expect_success 'status (status.showUntrackedFiles normal)' '
        git config status.showuntrackedfiles normal
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 cat >expect <<EOF
@@ -299,7 +384,6 @@ A  dir2/added
 ?? untracked
 EOF
 test_expect_success 'status -s -unormal' '
-       git config --unset status.showuntrackedfiles
        git status -s -unormal >output &&
        test_cmp expect output
 '
@@ -317,7 +401,7 @@ cat >expect <<EOF
 #
 #      new file:   dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -337,14 +421,18 @@ cat >expect <<EOF
 EOF
 test_expect_success 'status -uall' '
        git status -uall >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
+
 test_expect_success 'status (status.showUntrackedFiles all)' '
        git config status.showuntrackedfiles all
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
-       rm -rf dir3 &&
-       git config --unset status.showuntrackedfiles &&
-       test_cmp expect output
+       test_i18ncmp expect output
+'
+
+test_expect_success 'teardown dir3' '
+       rm -rf dir3
 '
 
 cat >expect <<EOF
@@ -377,7 +465,7 @@ cat >expect <<\EOF
 #
 #      new file:   ../dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -395,10 +483,8 @@ cat >expect <<\EOF
 EOF
 
 test_expect_success 'status with relative paths' '
-
        (cd dir1 && git status) >output &&
-       test_cmp expect output
-
+       test_i18ncmp expect output
 '
 
 cat >expect <<\EOF
@@ -438,18 +524,19 @@ test_expect_success 'status --porcelain ignores relative paths setting' '
 
 test_expect_success 'setup unique colors' '
 
-       git config status.color.untracked blue
+       git config status.color.untracked blue &&
+       git config status.color.branch green
 
 '
 
 cat >expect <<\EOF
-# On branch master
+# On branch <GREEN>master<RESET>
 # Changes to be committed:
 #   (use "git reset HEAD <file>..." to unstage)
 #
 #      <GREEN>new file:   dir2/added<RESET>
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -467,20 +554,17 @@ cat >expect <<\EOF
 EOF
 
 test_expect_success 'status with color.ui' '
-
        git config color.ui always &&
+       test_when_finished "git config --unset color.ui" &&
        git status | test_decode_color >output &&
-       test_cmp expect output
-
+       test_i18ncmp expect output
 '
 
 test_expect_success 'status with color.status' '
-
-       git config --unset color.ui &&
        git config color.status always &&
+       test_when_finished "git config --unset color.status" &&
        git status | test_decode_color >output &&
-       test_cmp expect output
-
+       test_i18ncmp expect output
 '
 
 cat >expect <<\EOF
@@ -496,7 +580,6 @@ EOF
 
 test_expect_success 'status -s with color.ui' '
 
-       git config --unset color.status &&
        git config color.ui always &&
        git status -s | test_decode_color >output &&
        test_cmp expect output
@@ -512,6 +595,25 @@ test_expect_success 'status -s with color.status' '
 
 '
 
+cat >expect <<\EOF
+## <GREEN>master<RESET>
+ <RED>M<RESET> dir1/modified
+<GREEN>A<RESET>  dir2/added
+<BLUE>??<RESET> dir1/untracked
+<BLUE>??<RESET> dir2/modified
+<BLUE>??<RESET> dir2/untracked
+<BLUE>??<RESET> expect
+<BLUE>??<RESET> output
+<BLUE>??<RESET> untracked
+EOF
+
+test_expect_success 'status -s -b with color.status' '
+
+       git status -s -b | test_decode_color >output &&
+       test_cmp expect output
+
+'
+
 cat >expect <<\EOF
  M dir1/modified
 A  dir2/added
@@ -545,6 +647,13 @@ test_expect_success 'status --porcelain ignores color.status' '
 git config --unset color.status
 git config --unset color.ui
 
+test_expect_success 'status --porcelain ignores -b' '
+
+       git status --porcelain -b >output &&
+       test_cmp expect output
+
+'
+
 cat >expect <<\EOF
 # On branch master
 # Changes to be committed:
@@ -552,7 +661,7 @@ cat >expect <<\EOF
 #
 #      new file:   dir2/added
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -572,9 +681,10 @@ EOF
 
 test_expect_success 'status without relative paths' '
 
-       git config status.relativePaths false
+       git config status.relativePaths false &&
+       test_when_finished "git config --unset status.relativePaths" &&
        (cd dir1 && git status) >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
@@ -591,6 +701,8 @@ EOF
 
 test_expect_success 'status -s without relative paths' '
 
+       git config status.relativePaths false &&
+       test_when_finished "git config --unset status.relativePaths" &&
        (cd dir1 && git status -s) >output &&
        test_cmp expect output
 
@@ -614,6 +726,16 @@ cat <<EOF >expect
 EOF
 test_expect_success 'dry-run of partial commit excluding new file in index' '
        git commit --dry-run dir1/modified >output &&
+       test_i18ncmp expect output
+'
+
+cat >expect <<EOF
+:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M     dir1/modified
+EOF
+test_expect_success 'status refreshes the index' '
+       touch dir2/added &&
+       git status &&
+       git diff-files >output &&
        test_cmp expect output
 '
 
@@ -635,7 +757,7 @@ cat >expect <<EOF
 #      new file:   dir2/added
 #      new file:   sm
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -653,13 +775,13 @@ cat >expect <<EOF
 EOF
 test_expect_success 'status submodule summary is disabled by default' '
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 # we expect the same as the previous test
 test_expect_success 'status --untracked-files=all does not show submodule' '
        git status --untracked-files=all >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 cat >expect <<EOF
@@ -694,7 +816,7 @@ cat >expect <<EOF
 #      new file:   dir2/added
 #      new file:   sm
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -718,7 +840,7 @@ EOF
 test_expect_success 'status submodule summary' '
        git config status.submodulesummary 10 &&
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 cat >expect <<EOF
@@ -739,7 +861,7 @@ test_expect_success 'status -s submodule summary' '
 
 cat >expect <<EOF
 # On branch master
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -756,13 +878,13 @@ cat >expect <<EOF
 #      untracked
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
-test_expect_success 'status submodule summary (clean submodule)' '
+test_expect_success 'status submodule summary (clean submodule): commit' '
        git commit -m "commit submodule" &&
        git config status.submodulesummary 10 &&
        test_must_fail git commit --dry-run >output &&
-       test_cmp expect output &&
+       test_i18ncmp expect output &&
        git status >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 cat >expect <<EOF
@@ -779,6 +901,13 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
        test_cmp expect output
 '
 
+test_expect_success 'status -z implies porcelain' '
+       git status --porcelain |
+       perl -pe "s/\012/\000/g" >expect &&
+       git status -z >output &&
+       test_cmp expect output
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -787,7 +916,7 @@ cat >expect <<EOF
 #      new file:   dir2/added
 #      new file:   sm
 #
-# Changed but not updated:
+# Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
@@ -811,7 +940,324 @@ EOF
 test_expect_success 'commit --dry-run submodule summary (--amend)' '
        git config status.submodulesummary 10 &&
        git commit --dry-run --amend >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
+'
+
+test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
+       (
+               chmod a-w .git &&
+               # make dir1/tracked stat-dirty
+               >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
+               git status -s >output &&
+               ! grep dir1/tracked output &&
+               # make sure "status" succeeded without writing index out
+               git diff-files | grep dir1/tracked
+       )
+       status=$?
+       chmod 775 .git
+       (exit $status)
+'
+
+(cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
+new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
+touch .gitmodules
+
+cat > expect << EOF
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#      modified:   sm
+#
+# Changes not staged for commit:
+#   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
+#
+#      modified:   dir1/modified
+#
+# Submodule changes to be committed:
+#
+# * sm $head...$new_head (1):
+#   > Add bar
+#
+# Untracked files:
+#   (use "git add <file>..." to include in what will be committed)
+#
+#      .gitmodules
+#      dir1/untracked
+#      dir2/modified
+#      dir2/untracked
+#      expect
+#      output
+#      untracked
+EOF
+
+test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
+       echo modified  sm/untracked &&
+       git status --ignore-submodules=untracked >output &&
+       test_i18ncmp expect output
+'
+
+test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
+       git config diff.ignoreSubmodules dirty &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --add -f .gitmodules submodule.subname.ignore untracked &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname &&
+       git config --unset diff.ignoreSubmodules
+'
+
+test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore untracked &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config --remove-section -f .gitmodules submodule.subname
+'
+
+test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
+       git status --ignore-submodules=dirty >output &&
+       test_i18ncmp expect output
+'
+
+test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
+       git config diff.ignoreSubmodules dirty &&
+       git status >output &&
+       ! test -s actual &&
+       git config --add -f .gitmodules submodule.subname.ignore dirty &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname &&
+       git config --unset diff.ignoreSubmodules
+'
+
+test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore dirty &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
+       echo modified >sm/foo &&
+       git status --ignore-submodules=dirty >output &&
+       test_i18ncmp expect output
+'
+
+test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
+       git config --add -f .gitmodules submodule.subname.ignore dirty &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore dirty &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+cat > expect << EOF
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#      modified:   sm
+#
+# Changes not staged for commit:
+#   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
+#   (commit or discard the untracked or modified content in submodules)
+#
+#      modified:   dir1/modified
+#      modified:   sm (modified content)
+#
+# Submodule changes to be committed:
+#
+# * sm $head...$new_head (1):
+#   > Add bar
+#
+# Untracked files:
+#   (use "git add <file>..." to include in what will be committed)
+#
+#      .gitmodules
+#      dir1/untracked
+#      dir2/modified
+#      dir2/untracked
+#      expect
+#      output
+#      untracked
+EOF
+
+test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
+       git status --ignore-submodules=untracked > output &&
+       test_i18ncmp expect output
+'
+
+test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
+       git config --add -f .gitmodules submodule.subname.ignore untracked &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore untracked &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
+
+cat > expect << EOF
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#      modified:   sm
+#
+# Changes not staged for commit:
+#   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
+#
+#      modified:   dir1/modified
+#      modified:   sm (new commits)
+#
+# Submodule changes to be committed:
+#
+# * sm $head...$new_head (1):
+#   > Add bar
+#
+# Submodules changed but not updated:
+#
+# * sm $new_head...$head2 (1):
+#   > 2nd commit
+#
+# Untracked files:
+#   (use "git add <file>..." to include in what will be committed)
+#
+#      .gitmodules
+#      dir1/untracked
+#      dir2/modified
+#      dir2/untracked
+#      expect
+#      output
+#      untracked
+EOF
+
+test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
+       git status --ignore-submodules=untracked > output &&
+       test_i18ncmp expect output
+'
+
+test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
+       git config --add -f .gitmodules submodule.subname.ignore untracked &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore untracked &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
+       git status --ignore-submodules=dirty > output &&
+       test_i18ncmp expect output
+'
+test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
+       git config --add -f .gitmodules submodule.subname.ignore dirty &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore dirty &&
+       git config --add submodule.subname.path sm &&
+       git status >output &&
+       test_i18ncmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+cat > expect << EOF
+# On branch master
+# Changes not staged for commit:
+#   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
+#
+#      modified:   dir1/modified
+#
+# Untracked files:
+#   (use "git add <file>..." to include in what will be committed)
+#
+#      .gitmodules
+#      dir1/untracked
+#      dir2/modified
+#      dir2/untracked
+#      expect
+#      output
+#      untracked
+no changes added to commit (use "git add" and/or "git commit -a")
+EOF
+
+test_expect_success "--ignore-submodules=all suppresses submodule summary" '
+       git status --ignore-submodules=all > output &&
+       test_i18ncmp expect output
+'
+
+test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
+       git config --add -f .gitmodules submodule.subname.ignore all &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git status > output &&
+       test_cmp expect output &&
+       git config -f .gitmodules  --remove-section submodule.subname
+'
+
+test_expect_failure '.git/config ignore=all suppresses submodule summary' '
+       git config --add -f .gitmodules submodule.subname.ignore none &&
+       git config --add -f .gitmodules submodule.subname.path sm &&
+       git config --add submodule.subname.ignore all &&
+       git config --add submodule.subname.path sm &&
+       git status > output &&
+       test_cmp expect output &&
+       git config --remove-section submodule.subname &&
+       git config -f .gitmodules  --remove-section submodule.subname
 '
 
 test_done