3 test_description
='git apply with weird postimage filenames'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
9 vector=$TEST_DIRECTORY/t4135 &&
12 git commit --allow-empty -m preimage &&
16 git checkout -f preimage^0 &&
17 git read-tree -u --reset HEAD &&
18 git update-index --refresh
30 test_expect_
$exp1 $prereq "$desc, git-style file creation patch" "
31 echo postimage >expected &&
34 git apply -v \"\$vector\"/'git-$desc.diff' &&
35 test_cmp expected '$postimage'
38 test_expect_
$exp2 $prereq "$desc, traditional patch" "
39 echo postimage >expected &&
41 echo preimage >'$postimage' &&
42 git apply -v \"\$vector\"/'diff-$desc.diff' &&
43 test_cmp expected '$postimage'
46 test_expect_
$exp3 $prereq "$desc, traditional file creation patch" "
47 echo postimage >expected &&
50 git apply -v \"\$vector\"/'add-$desc.diff' &&
51 test_cmp expected '$postimage'
55 try_filename
'plain' 'postimage.txt'
56 try_filename
'with spaces' 'post image.txt'
57 try_filename
'with tab' 'post image.txt' FUNNYNAMES
58 try_filename
'with backslash' 'post\image.txt' BSLASHPSPEC
59 try_filename
'with quote' '"postimage".txt' FUNNYNAMES success failure success
61 test_expect_success
'whitespace-damaged traditional patch' '
62 echo postimage >expected &&
64 rm -f postimage.txt &&
65 git apply -v "$vector/damaged.diff" &&
66 test_cmp expected postimage.txt
69 test_expect_success
'traditional patch with colon in timezone' '
70 echo postimage >expected &&
72 rm -f "post image.txt" &&
73 git apply "$vector/funny-tz.diff" &&
74 test_cmp expected "post image.txt"
77 test_expect_success
'traditional, whitespace-damaged, colon in timezone' '
78 echo postimage >expected &&
80 rm -f "post image.txt" &&
81 git apply "$vector/damaged-tz.diff" &&
82 test_cmp expected "post image.txt"
85 cat >diff-from-svn
<<\EOF
87 ===================================================================
88 diff --git a
/branches
/Makefile
89 deleted
file mode
100644
90 --- a
/branches
/Makefile
(revision
13)
91 +++ /dev
/null
(nonexistent
)
96 test_expect_success
'apply handles a diff generated by Subversion' '
98 git apply -p2 diff-from-svn &&
99 test_path_is_missing Makefile