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/t4126-apply-empty.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 / t4126-apply-empty.sh` 92 lines ยท 2242 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='apply empty' 4 5 . ./test-lib.sh 6 7 test_expect_success setup ' 8 >empty && 9 git add empty && 10 test_tick && 11 git commit -m initial && 12 git commit --allow-empty -m "empty commit" && 13 git format-patch --always HEAD~ >empty.patch && 14 test_write_lines a b c d e >empty && 15 cat empty >expect && 16 git diff | 17 sed -e "/^diff --git/d" \ 18 -e "/^index /d" \ 19 -e "s|a/empty|empty.orig|" \ 20 -e "s|b/empty|empty|" >patch0 && 21 sed -e "s|empty|missing|" patch0 >patch1 && 22 >empty && 23 git update-index --refresh 24 ' 25 26 test_expect_success 'apply empty' ' 27 rm -f missing && 28 test_when_finished "git reset --hard" && 29 git apply patch0 && 30 test_cmp expect empty 31 ' 32 33 test_expect_success 'apply empty patch fails' ' 34 test_when_finished "git reset --hard" && 35 test_must_fail git apply empty.patch && 36 test_must_fail git apply - "funny /empty" && 73 git add "funny /empty" && 74 git diff HEAD -- "funny /" >sample.patch && 75 git diff -R HEAD -- "funny /" >elpmas.patch && 76 77 git reset --hard && 78 79 git apply --stat --check --apply sample.patch && 80 test_must_be_empty "funny /empty" && 81 82 git apply --stat --check --apply elpmas.patch && 83 test_path_is_missing "funny /empty" && 84 85 git apply -R --stat --check --apply elpmas.patch && 86 test_must_be_empty "funny /empty" && 87 88 git apply -R --stat --check --apply sample.patch && 89 test_path_is_missing "funny /empty" 90 ' 91 92 test_done