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/t4118-apply-empty-context.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 / t4118-apply-empty-context.sh` 52 lines ยท 940 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2006 Junio C Hamano 4 # 5 6 test_description='git apply with new style GNU diff with empty context 7 8 ' 9 10 11 . ./test-lib.sh 12 13 test_expect_success setup ' 14 test_write_lines "" "" A B C "" >file1 && 15 cat file1 >file1.orig && 16 { 17 cat file1 && 18 echo Q | tr -d "\\012" 19 } >file2 && 20 cat file2 >file2.orig && 21 git add file1 file2 && 22 sed -e "/^B/d" file1 && 23 cat file1 > file2 && 24 echo Q | tr -d "\\012" >>file2 && 25 cat file1 >file1.mods && 26 cat file2 >file2.mods && 27 git diff | 28 sed -e "s/^ \$//" >diff.output 29 ' 30 31 test_expect_success 'apply --numstat' ' 32 33 git apply --numstat diff.output >actual && 34 { 35 echo "0 1 file1" && 36 echo "0 1 file2" 37 } >expect && 38 test_cmp expect actual 39 40 ' 41 42 test_expect_success 'apply --apply' ' 43 44 cat file1.orig >file1 && 45 cat file2.orig >file2 && 46 git update-index file1 file2 && 47 git apply --index diff.output && 48 test_cmp file1.mods file1 && 49 test_cmp file2.mods file2 50 ' 51 52 test_done