-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test all possible use-cases of git-status "--ignored" with the "--untracked-files" option with values "normal" and "all": - An untracked directory is listed as untracked if it has a mix of untracked and ignored files in it. With -uall, ignored/untracked files are listed as ignored/untracked. - An untracked directory with only ignored files is listed as ignored. With -uall, all files in the directory are listed. - An ignored directory is listed as ignored. With -uall, all files in the directory are listed as ignored. - An ignored and committed directory is listed as ignored if it has untracked files. With -uall, all untracked files in the directory are listed as ignored. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Antoine Pelisse
authored and
Junio C Hamano
committed
Jan 2, 2013
1 parent
721ac4e
commit eb8c5b8
Showing
1 changed file
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
#!/bin/sh | ||
|
||
test_description='git-status ignored files' | ||
|
||
. ./test-lib.sh | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
?? untracked/ | ||
EOF | ||
|
||
test_expect_success 'status untracked directory with --ignored' ' | ||
echo "ignored" >.gitignore && | ||
mkdir untracked && | ||
: >untracked/ignored && | ||
: >untracked/uncommitted && | ||
git status --porcelain --ignored >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
?? untracked/uncommitted | ||
!! untracked/ignored | ||
EOF | ||
|
||
test_expect_success 'status untracked directory with --ignored -u' ' | ||
git status --porcelain --ignored -u >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! ignored/ | ||
EOF | ||
|
||
test_expect_success 'status ignored directory with --ignore' ' | ||
rm -rf untracked && | ||
mkdir ignored && | ||
: >ignored/uncommitted && | ||
git status --porcelain --ignored >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! ignored/uncommitted | ||
EOF | ||
|
||
test_expect_success 'status ignored directory with --ignore -u' ' | ||
git status --porcelain --ignored -u >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! untracked-ignored/ | ||
EOF | ||
|
||
test_expect_success 'status untracked directory with ignored files with --ignore' ' | ||
rm -rf ignored && | ||
mkdir untracked-ignored && | ||
mkdir untracked-ignored/test && | ||
: >untracked-ignored/ignored && | ||
: >untracked-ignored/test/ignored && | ||
git status --porcelain --ignored >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! untracked-ignored/ignored | ||
!! untracked-ignored/test/ignored | ||
EOF | ||
|
||
test_expect_success 'status untracked directory with ignored files with --ignore -u' ' | ||
git status --porcelain --ignored -u >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
EOF | ||
|
||
test_expect_success 'status ignored tracked directory with --ignore' ' | ||
rm -rf untracked-ignored && | ||
mkdir tracked && | ||
: >tracked/committed && | ||
git add tracked/committed && | ||
git commit -m. && | ||
echo "tracked" >.gitignore && | ||
git status --porcelain --ignored >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
EOF | ||
|
||
test_expect_success 'status ignored tracked directory with --ignore -u' ' | ||
git status --porcelain --ignored -u >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! tracked/ | ||
EOF | ||
|
||
test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' ' | ||
: >tracked/uncommitted && | ||
git status --porcelain --ignored >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
cat >expected <<\EOF | ||
?? .gitignore | ||
?? actual | ||
?? expected | ||
!! tracked/uncommitted | ||
EOF | ||
|
||
test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' ' | ||
git status --porcelain --ignored -u >actual && | ||
test_cmp expected actual | ||
' | ||
|
||
test_done |