git/t/t7061-wtstatus-ignore.sh
Karsten Blees 560bb7a7a1 dir.c: git-status --ignored: don't drop ignored directories
'git-status --ignored' drops ignored directories if they contain untracked
files in an untracked sub directory.

Fix it by getting exact (recursive) excluded status in treat_directory.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-15 12:33:58 -07:00

174 lines
3.5 KiB
Bash
Executable File

#!/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
'
cat >expected <<\EOF
?? .gitignore
?? actual
?? expected
!! tracked/
EOF
test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore' '
rm -rf tracked/uncommitted &&
mkdir tracked/ignored &&
: >tracked/ignored/uncommitted &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
cat >expected <<\EOF
?? .gitignore
?? actual
?? expected
!! tracked/ignored/uncommitted
EOF
test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore -u' '
git status --porcelain --ignored -u >actual &&
test_cmp expected actual
'
test_done