3 test_description
='apply same filename'
7 test_expect_success
'setup' '
9 mkdir -p some/sub/dir &&
10 echo Hello > some/sub/dir/file &&
11 git add some/sub/dir/file &&
12 git commit -m initial &&
18 diff a/bla/blub/dir/file b/bla/blub/dir/file
19 --- a/bla/blub/dir/file
20 +++ b/bla/blub/dir/file
26 test_expect_success
'apply --directory -p (1)' '
27 git apply --directory=some/sub -p3 --index patch &&
29 git show :some/sub/dir/file >actual &&
30 test_cmp expect actual &&
31 test_cmp expect some/sub/dir/file
35 test_expect_success
'apply --directory -p (2) ' '
37 git reset --hard initial &&
38 git apply --directory=some/sub/ -p3 --index patch &&
40 git show :some/sub/dir/file >actual &&
41 test_cmp expect actual &&
42 test_cmp expect some/sub/dir/file
47 diff --git a/newfile b/newfile
49 index 0000000..d95f3ad
56 test_expect_success
'apply --directory (new file)' '
57 git reset --hard initial &&
58 git apply --directory=some/sub/dir/ --index patch &&
59 echo content >expect &&
60 git show :some/sub/dir/newfile >actual &&
61 test_cmp expect actual &&
62 test_cmp expect some/sub/dir/newfile
66 diff --git a/c/newfile2 b/c/newfile2
68 index 0000000..d95f3ad
75 test_expect_success
'apply --directory -p (new file)' '
76 git reset --hard initial &&
77 git apply -p2 --directory=some/sub/dir/ --index patch &&
78 echo content >expect &&
79 git show :some/sub/dir/newfile2 >actual &&
80 test_cmp expect actual &&
81 test_cmp expect some/sub/dir/newfile2
85 diff --git a/delfile b/delfile
86 deleted file mode 100644
87 index d95f3ad..0000000
94 test_expect_success
'apply --directory (delete file)' '
95 git reset --hard initial &&
96 echo content >some/sub/dir/delfile &&
97 git add some/sub/dir/delfile &&
98 git apply --directory=some/sub/dir/ --index patch &&
104 diff --git "a/qu\157tefile" "b/qu\157tefile"
106 index
0000000..d95f3ad
113 test_expect_success
'apply --directory (quoted filename)' '
114 git reset --hard initial &&
115 git apply --directory=some/sub/dir/ --index patch &&
116 echo content >expect &&
117 git show :some/sub/dir/quotefile >actual &&
118 test_cmp expect actual &&
119 test_cmp expect some/sub/dir/quotefile