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
75 test_expect_success 'traditional patch with colon in timezone' '
76 echo postimage >expected &&
78 rm -f "post image.txt" &&
79 git apply "$vector/funny-tz.diff" &&
80 test_cmp expected "post image.txt"
83 test_expect_success 'traditional, whitespace-damaged, colon in timezone' '
84 echo postimage >expected &&
86 rm -f "post image.txt" &&
87 git apply "$vector/damaged-tz.diff" &&
88 test_cmp expected "post image.txt"