aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-21 14:16:46 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-21 14:16:46 -0700
commit9d880582ee0e63b3865350e90d3576fec55aed20 (patch)
tree09edc39b6918dce863c0e88e4c5508a4f957454b /t
parent8fe114a6e1d606eb806b3f87b17fc22f106af7b7 (diff)
parentdad25e4a7c34a3ece1355f84b8c4661438754531 (diff)
downloadgit-9d880582ee0e63b3865350e90d3576fec55aed20.tar.gz
git-9d880582ee0e63b3865350e90d3576fec55aed20.tar.xz
Merge branch 'ar/add-unreadable'
* ar/add-unreadable: Add a config option to ignore errors for git-add Add a test for git-add --ignore-errors Add --ignore-errors to git-add to allow it to skip files with read errors Extend interface of add_files_to_cache to allow ignore indexing errors Make the exit code of add_file_to_index actually useful
Diffstat (limited to 't')
-rwxr-xr-xt/t3700-add.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 68c5ddebd..e83fa1f68 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -179,4 +179,47 @@ 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_done