Skip to content

Commit

Permalink
Add tests for the diff.ignoreSubmodules config option
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Lehmann <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
jlehmann authored and gitster committed Aug 9, 2010
1 parent be4f2b4 commit 90e1452
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion t/t4027-diff-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
'

test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.git/config]' '
git config diff.ignoreSubmodules all &&
git diff HEAD >actual &&
! test -s actual &&
git config submodule.subname.ignore none &&
git config submodule.subname.path sub &&
git diff HEAD >actual &&
Expand All @@ -136,10 +139,14 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
sed -e "1,/^@@/d" actual >actual.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git config --remove-section submodule.subname
git config --remove-section submodule.subname &&
git config --unset diff.ignoreSubmodules
'

test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
git config diff.ignoreSubmodules dirty &&
git diff HEAD >actual &&
! test -s actual &&
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual &&
Expand All @@ -166,6 +173,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
test_cmp expect.body actual.body &&
git config --remove-section submodule.subname &&
git config --remove-section -f .gitmodules submodule.subname &&
git config --unset diff.ignoreSubmodules &&
rm .gitmodules
'

Expand Down
12 changes: 10 additions & 2 deletions t/t7508-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,15 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
'

test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
git config diff.ignoreSubmodules dirty &&
git status >output &&
test_cmp expect output &&
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
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' '
Expand All @@ -873,11 +877,15 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
'

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_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
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' '
Expand Down

0 comments on commit 90e1452

Please sign in to comment.