@ -808,24 +808,38 @@ test_expect_success POSIXPERM 'status succeeds in a read-only repository' '
(exit $status)
(exit $status)
'
'
(cd sm && echo > bar && git add bar && git commit -q -m 'Add bar' && cd .. && git add sm)
new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
touch .gitmodules
cat > expect << EOF
cat > expect << EOF
# On branch master
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sm
#
# Changed but not updated:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
#
# modified: dir1/modified
# modified: dir1/modified
#
#
# Submodule changes to be committed:
#
# * sm $head...$new_head (1):
# > Add bar
#
# Untracked files:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# (use "git add <file>..." to include in what will be committed)
#
#
# .gitmodules
# dir1/untracked
# dir1/untracked
# dir2/modified
# dir2/modified
# dir2/untracked
# dir2/untracked
# expect
# expect
# output
# output
# untracked
# untracked
no changes added to commit (use "git add" and/or "git commit -a")
EOF
EOF
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
@ -834,19 +848,48 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
test_cmp expect output
test_cmp expect output
'
'
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
git status --ignore-submodules=dirty > output &&
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_cmp expect output
'
'
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
echo modified > sm/foo &&
echo modified > sm/foo &&
git status --ignore-submodules=dirty > output &&
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_cmp expect output
'
'
test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
cat > expect << EOF
cat > expect << EOF
# On branch master
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sm
#
# Changed but not updated:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (use "git checkout -- <file>..." to discard changes in working directory)
@ -855,16 +898,21 @@ cat > expect << EOF
# modified: dir1/modified
# modified: dir1/modified
# modified: sm (modified content)
# modified: sm (modified content)
#
#
# Submodule changes to be committed:
#
# * sm $head...$new_head (1):
# > Add bar
#
# Untracked files:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# (use "git add <file>..." to include in what will be committed)
#
#
# .gitmodules
# dir1/untracked
# dir1/untracked
# dir2/modified
# dir2/modified
# dir2/untracked
# dir2/untracked
# expect
# expect
# output
# output
# untracked
# untracked
no changes added to commit (use "git add" and/or "git commit -a")
EOF
EOF
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
@ -872,10 +920,23 @@ test_expect_success "--ignore-submodules=untracked doesn't suppress submodules w
test_cmp expect output
test_cmp expect output
'
'
test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
cat > expect << EOF
cat > expect << EOF
# On branch master
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sm
#
# Changed but not updated:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (use "git checkout -- <file>..." to discard changes in working directory)
@ -883,21 +944,26 @@ cat > expect << EOF
# modified: dir1/modified
# modified: dir1/modified
# modified: sm (new commits)
# modified: sm (new commits)
#
#
# Submodule changes to be committed:
#
# * sm $head...$new_head (1):
# > Add bar
#
# Submodules changed but not updated:
# Submodules changed but not updated:
#
#
# * sm $head...$head2 (1):
# * sm $new_head...$head2 (1):
# > 2nd commit
# > 2nd commit
#
#
# Untracked files:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# (use "git add <file>..." to include in what will be committed)
#
#
# .gitmodules
# dir1/untracked
# dir1/untracked
# dir2/modified
# dir2/modified
# dir2/untracked
# dir2/untracked
# expect
# expect
# output
# output
# untracked
# untracked
no changes added to commit (use "git add" and/or "git commit -a")
EOF
EOF
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
@ -905,11 +971,28 @@ test_expect_success "--ignore-submodules=untracked doesn't suppress submodule su
test_cmp expect output
test_cmp expect output
'
'
test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
git status --ignore-submodules=dirty > output &&
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_cmp expect output
'
'
test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config --remove-section submodule.subname
'
cat > expect << EOF
cat > expect << EOF
# On branch master
# On branch master
# Changed but not updated:
# Changed but not updated:
@ -921,6 +1004,7 @@ cat > expect << EOF
# Untracked files:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# (use "git add <file>..." to include in what will be committed)
#
#
# .gitmodules
# dir1/untracked
# dir1/untracked
# dir2/modified
# dir2/modified
# dir2/untracked
# dir2/untracked
@ -935,4 +1019,12 @@ test_expect_success "--ignore-submodules=all suppresses submodule summary" '
test_cmp expect output
test_cmp expect output
'
'
test_expect_failure '.git/config ignore=all suppresses submodule summary' '
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
'
test_done
test_done