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/t4140-apply-ita.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 / t4140-apply-ita.sh` 85 lines ยท 2104 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git apply of i-t-a file' 4 5 . ./test-lib.sh 6 7 test_expect_success setup ' 8 test_write_lines 1 2 3 4 5 >blueprint && 9 10 cat blueprint >committed-file && 11 git add committed-file && 12 git commit -m "commit" && 13 14 cat blueprint >test-file && 15 git add -N test-file && 16 git diff >creation-patch && 17 test_grep "new file mode 100644" creation-patch && 18 19 rm -f test-file && 20 git diff >deletion-patch && 21 test_grep "deleted file mode 100644" deletion-patch && 22 23 git rm -f test-file && 24 test_write_lines 6 >>committed-file && 25 cat blueprint >test-file && 26 git add -N test-file && 27 git diff >complex-patch && 28 git restore committed-file 29 ' 30 31 test_expect_success 'apply creation patch to ita path (--cached)' ' 32 git rm -f test-file && 33 cat blueprint >test-file && 34 git add -N test-file && 35 36 git apply --cached creation-patch && 37 git cat-file blob :test-file >actual && 38 test_cmp blueprint actual 39 ' 40 41 test_expect_success 'apply creation patch to ita path (--index)' ' 42 git rm -f test-file && 43 cat blueprint >test-file && 44 git add -N test-file && 45 rm -f test-file && 46 47 test_must_fail git apply --index creation-patch 48 ' 49 50 test_expect_success 'apply deletion patch to ita path (--cached)' ' 51 git rm -f test-file && 52 cat blueprint >test-file && 53 git add -N test-file && 54 55 git apply --cached deletion-patch && 56 test_must_fail git ls-files --stage --error-unmatch test-file 57 ' 58 59 test_expect_success 'apply deletion patch to ita path (--index)' ' 60 cat blueprint >test-file && 61 git add -N test-file && 62 63 test_must_fail git apply --index deletion-patch && 64 git ls-files --stage --error-unmatch test-file 65 ' 66 67 test_expect_success 'apply creation patch to existing index with -N' ' 68 git rm -f test-file && 69 cat blueprint >index-file && 70 git add index-file && 71 git apply -N creation-patch && 72 73 git ls-files --stage --error-unmatch index-file && 74 git ls-files --stage --error-unmatch test-file 75 ' 76 77 test_expect_success 'apply complex patch with -N' ' 78 git rm -f test-file index-file && 79 git apply -N complex-patch && 80 81 git ls-files --stage --error-unmatch test-file && 82 git diff | grep "a/committed-file" 83 ' 84 85 test_done