3 test_description='git apply with weird postimage filenames'
7 test_expect_success 'setup' '
8 vector=$TEST_DIRECTORY/t4135 &&
11 git commit --allow-empty -m preimage &&
15 git checkout -f preimage^0 &&
16 git read-tree -u --reset HEAD &&
17 git update-index --refresh
20 test_when_finished "rm -f \"tab embedded.txt\"" &&
21 test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
22 if touch -- "tab embedded.txt" '\''"quoteembedded".txt'\''
24 test_set_prereq FUNNYNAMES
36 test_expect_$exp1 $prereq "$desc, git-style file creation patch" "
37 echo postimage >expected &&
40 git apply -v \"\$vector\"/'git-$desc.diff' &&
41 test_cmp expected '$postimage'
44 test_expect_$exp2 $prereq "$desc, traditional patch" "
45 echo postimage >expected &&
47 echo preimage >'$postimage' &&
48 git apply -v \"\$vector\"/'diff-$desc.diff' &&
49 test_cmp expected '$postimage'
52 test_expect_$exp3 $prereq "$desc, traditional file creation patch" "
53 echo postimage >expected &&
56 git apply -v \"\$vector\"/'add-$desc.diff' &&
57 test_cmp expected '$postimage'
61 try_filename 'plain' 'postimage.txt'
62 try_filename 'with spaces' 'post image.txt'
63 try_filename 'with tab' 'post image.txt' FUNNYNAMES
64 try_filename 'with backslash' 'post\image.txt' BSLASHPSPEC
65 try_filename 'with quote' '"postimage".txt' FUNNYNAMES success failure success
67 test_expect_success 'whitespace-damaged traditional patch' '
68 echo postimage >expected &&
70 rm -f postimage.txt &&
71 git apply -v "$vector/damaged.diff" &&
72 test_cmp expected postimage.txt