2012-12-30 18:39:01 +04:00
|
|
|
#!/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
|
|
|
|
'
|
|
|
|
|
2015-04-16 17:05:12 +03:00
|
|
|
test_expect_success 'same with gitignore starting with BOM' '
|
|
|
|
printf "\357\273\277ignored\n" >.gitignore &&
|
|
|
|
mkdir -p untracked &&
|
|
|
|
: >untracked/ignored &&
|
|
|
|
: >untracked/uncommitted &&
|
|
|
|
git status --porcelain --ignored >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
2012-12-30 18:39:01 +04:00
|
|
|
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
|
|
|
|
'
|
2013-04-15 23:09:25 +04:00
|
|
|
cat >expected <<\EOF
|
|
|
|
?? untracked/uncommitted
|
|
|
|
!! untracked/ignored
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status prefixed untracked directory with --ignored' '
|
|
|
|
git status --porcelain --ignored untracked/ >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >expected <<\EOF
|
|
|
|
?? untracked/uncommitted
|
|
|
|
!! untracked/ignored
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status prefixed untracked sub-directory with --ignored -u' '
|
|
|
|
git status --porcelain --ignored -u untracked/ >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
2012-12-30 18:39:01 +04:00
|
|
|
|
|
|
|
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
|
|
|
|
EOF
|
|
|
|
|
2013-04-15 23:08:42 +04:00
|
|
|
test_expect_success 'status empty untracked directory with --ignore' '
|
2012-12-30 18:39:01 +04:00
|
|
|
rm -rf ignored &&
|
|
|
|
mkdir untracked-ignored &&
|
|
|
|
mkdir untracked-ignored/test &&
|
2013-04-15 23:08:42 +04:00
|
|
|
git status --porcelain --ignored >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status empty untracked 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' '
|
2012-12-30 18:39:01 +04:00
|
|
|
: >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
|
|
|
|
'
|
|
|
|
|
2013-04-15 23:07:16 +04:00
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status ignored tracked directory and ignored file with --ignore' '
|
|
|
|
echo "committed" >>.gitignore &&
|
|
|
|
git status --porcelain --ignored >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status ignored tracked directory and ignored file with --ignore -u' '
|
|
|
|
git status --porcelain --ignored -u >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
2012-12-30 18:39:01 +04:00
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
2013-04-15 23:10:05 +04:00
|
|
|
!! tracked/uncommitted
|
2012-12-30 18:39:01 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
|
2013-04-15 23:07:16 +04:00
|
|
|
echo "tracked" >.gitignore &&
|
2012-12-30 18:39:01 +04:00
|
|
|
: >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
|
|
|
|
'
|
|
|
|
|
2013-04-15 23:05:19 +04:00
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
2013-04-15 23:10:05 +04:00
|
|
|
!! tracked/ignored/
|
2013-04-15 23:05:19 +04:00
|
|
|
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
|
|
|
|
'
|
|
|
|
|
2013-04-15 23:06:30 +04:00
|
|
|
cat >expected <<\EOF
|
|
|
|
?? .gitignore
|
|
|
|
?? actual
|
|
|
|
?? expected
|
2013-04-15 23:10:05 +04:00
|
|
|
!! tracked/ignored/uncommitted
|
2013-04-15 23:06:30 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore' '
|
|
|
|
: >tracked/ignored/committed &&
|
|
|
|
git add -f tracked/ignored/committed &&
|
|
|
|
git commit -m. &&
|
|
|
|
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 tracked subdir with --ignore -u' '
|
|
|
|
git status --porcelain --ignored -u >actual &&
|
|
|
|
test_cmp expected actual
|
|
|
|
'
|
|
|
|
|
2012-12-30 18:39:01 +04:00
|
|
|
test_done
|