dir.c: fix missing dir invalidation in untracked code
[gitweb.git] / t / t1060-object-corruption.sh
index e29406e27ae84b2b3c18de18b93014466d6dc0d8..ac1f189fd29b171c16af17e1d3ddda48f557df89 100755 (executable)
@@ -21,6 +21,14 @@ test_expect_success 'setup corrupt repo' '
                cd bit-error &&
                test_commit content &&
                corrupt_byte HEAD:content.t 10
+       ) &&
+       git init no-bit-error &&
+       (
+               # distinct commit from bit-error, but containing a
+               # non-corrupted version of the same blob
+               cd no-bit-error &&
+               test_tick &&
+               test_commit content
        )
 '
 
@@ -53,6 +61,13 @@ test_expect_success 'streaming a corrupt blob fails' '
        )
 '
 
+test_expect_success 'getting type of a corrupt blob fails' '
+       (
+               cd bit-error &&
+               test_must_fail git cat-file -s HEAD:content.t
+       )
+'
+
 test_expect_success 'read-tree -u detects bit-errors in blobs' '
        (
                cd bit-error &&
@@ -79,7 +94,7 @@ test_expect_success 'clone --no-local --bare detects missing object' '
        test_must_fail git clone --no-local --bare missing missing-transport
 '
 
-test_expect_failure 'clone --no-local --bare detects misnamed object' '
+test_expect_success 'clone --no-local --bare detects misnamed object' '
        test_must_fail git clone --no-local --bare misnamed misnamed-transport
 '
 
@@ -89,7 +104,11 @@ test_expect_success 'clone --local detects corruption' '
        test_must_fail git clone --local bit-error corrupt-checkout
 '
 
-test_expect_failure 'clone --local detects missing objects' '
+test_expect_success 'error detected during checkout leaves repo intact' '
+       test_path_is_dir corrupt-checkout/.git
+'
+
+test_expect_success 'clone --local detects missing objects' '
        test_must_fail git clone --local missing missing-checkout
 '
 
@@ -97,4 +116,13 @@ test_expect_failure 'clone --local detects misnamed objects' '
        test_must_fail git clone --local misnamed misnamed-checkout
 '
 
+test_expect_success 'fetch into corrupted repo with index-pack' '
+       (
+               cd bit-error &&
+               test_must_fail git -c transfer.unpackLimit=1 \
+                       fetch ../no-bit-error 2>stderr &&
+               test_i18ngrep ! -i collision stderr
+       )
+'
+
 test_done