X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3700-add.sh;h=2ac93a346d016c65614f2bf6142049e7bdc39bd1;hb=1500f7bc1366e71edb7e8a31f3cf5614e9591cc2;hp=68c5ddebdf565912af5f481283980169f069a7a6;hpb=c74815261225e5068490583b08303d158837ab9e;p=git.git diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 68c5ddebd..2ac93a346 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -85,12 +85,12 @@ test_expect_success '.gitignore is honored' ' ' test_expect_success 'error out when attempting to add ignored ones without -f' ' - ! git add a.?? && + test_must_fail git add a.?? && ! (git ls-files | grep "\\.ig") ' test_expect_success 'error out when attempting to add ignored ones without -f' ' - ! git add d.?? && + test_must_fail git add d.?? && ! (git ls-files | grep "\\.ig") ' @@ -179,4 +179,55 @@ test_expect_success 'git add --refresh' ' test -z "`git diff-index HEAD -- foo`" ' +test_expect_success 'git add should fail atomically upon an unreadable file' ' + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose . && + ! ( git ls-files foo1 | grep foo1 ) +' + +rm -f foo2 + +test_expect_success 'git add --ignore-errors' ' + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose --ignore-errors . && + git ls-files foo1 | grep foo1 +' + +rm -f foo2 + +test_expect_success 'git add (add.ignore-errors)' ' + git config add.ignore-errors 1 && + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose . && + git ls-files foo1 | grep foo1 +' +rm -f foo2 + +test_expect_success 'git add (add.ignore-errors = false)' ' + git config add.ignore-errors 0 && + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose . && + ! ( git ls-files foo1 | grep foo1 ) +' + +test_expect_success 'git add '\''fo\[ou\]bar'\'' ignores foobar' ' + git reset --hard && + touch fo\[ou\]bar foobar && + git add '\''fo\[ou\]bar'\'' && + git ls-files fo\[ou\]bar | grep -F fo\[ou\]bar && + ! ( git ls-files foobar | grep foobar ) +' + test_done