Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t0093-verify-cache-df-gap.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t0093-verify-cache-df-gap.sh` 59 lines ยท 1657 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='verify_cache() must catch non-adjacent D/F conflicts 4 5 Ensure that verify_cache() can complain about bad entries like: 6 7 docs <-- submodule 8 docs-internal/... <-- sorts here because "-" < "/" 9 docs/... <-- D/F conflict with "docs" above, not adjacent 10 11 In order to test verify_cache, we directly construct a corrupt index 12 (bypassing the D/F safety checks in add_index_entry) and verify that 13 write-tree rejects it. 14 ' 15 16 . ./test-lib.sh 17 18 if ! test_have_prereq PERL 19 then 20 skip_all='skipping verify_cache D/F tests; Perl not available' 21 test_done 22 fi 23 24 # Build a v2 index from entries on stdin, bypassing D/F checks. 25 # Each line: "octalmode hex-oid name" (entries must be pre-sorted). 26 build_corrupt_index () { 27 perl "$TEST_DIRECTORY/t0093-direct-index-write.pl" >"$1" 28 } 29 30 test_expect_success 'setup objects' ' 31 test_commit base && 32 BLOB=$(git rev-parse HEAD:base.t) && 33 SUB_COMMIT=$(git rev-parse HEAD) 34 ' 35 36 test_expect_success 'adjacent D/F conflict is caught by verify_cache' ' 37 cat >index-entries <<-EOF && 38 `0160000` $SUB_COMMIT docs 39 `0100644` $BLOB docs/requirements.txt 40 EOF 41 build_corrupt_index .git/index err && 44 test_grep "You have both docs and docs/requirements.txt" err 45 ' 46 47 test_expect_success 'non-adjacent D/F conflict is caught by verify_cache' ' 48 cat >index-entries <<-EOF && 49 `0160000` $SUB_COMMIT docs 50 `0100644` $BLOB docs-internal/README.md 51 `0100644` $BLOB docs/requirements.txt 52 EOF 53 build_corrupt_index .git/index err && 56 test_grep "You have both docs and docs/requirements.txt" err 57 ' 58 59 test_done