Browse Source
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>maint
![apelisse@gmail.com](/assets/img/avatar_default.png)
![Junio C Hamano](/assets/img/avatar_default.png)
1 changed files with 146 additions and 0 deletions
@ -0,0 +1,146 @@
@@ -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 |
Loading…
Reference in new issue