3 test_description
='apply same filename'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
10 mkdir -p some/sub/dir &&
11 echo Hello > some/sub/dir/file &&
12 git add some/sub/dir/file &&
13 git commit -m initial &&
19 diff a/bla/blub/dir/file b/bla/blub/dir/file
20 --- a/bla/blub/dir/file
21 +++ b/bla/blub/dir/file
27 test_expect_success
'apply --directory -p (1)' '
28 git apply --directory=some/sub -p3 --index patch &&
30 git show :some/sub/dir/file >actual &&
31 test_cmp expect actual &&
32 test_cmp expect some/sub/dir/file
36 test_expect_success
'apply --directory -p (2) ' '
38 git reset --hard initial &&
39 git apply --directory=some/sub/ -p3 --index patch &&
41 git show :some/sub/dir/file >actual &&
42 test_cmp expect actual &&
43 test_cmp expect some/sub/dir/file
48 diff --git a/newfile b/newfile
50 index 0000000..d95f3ad
57 test_expect_success
'apply --directory (new file)' '
58 git reset --hard initial &&
59 git apply --directory=some/sub/dir/ --index patch &&
60 echo content >expect &&
61 git show :some/sub/dir/newfile >actual &&
62 test_cmp expect actual &&
63 test_cmp expect some/sub/dir/newfile
67 diff --git a/c/newfile2 b/c/newfile2
69 index 0000000..d95f3ad
76 test_expect_success
'apply --directory -p (new file)' '
77 git reset --hard initial &&
78 git apply -p2 --directory=some/sub/dir/ --index patch &&
79 echo content >expect &&
80 git show :some/sub/dir/newfile2 >actual &&
81 test_cmp expect actual &&
82 test_cmp expect some/sub/dir/newfile2
86 diff --git a/delfile b/delfile
87 deleted file mode 100644
88 index d95f3ad..0000000
95 test_expect_success
'apply --directory (delete file)' '
96 git reset --hard initial &&
97 echo content >some/sub/dir/delfile &&
98 git add some/sub/dir/delfile &&
99 git apply --directory=some/sub/dir/ --index patch &&
105 diff --git "a/qu\157tefile" "b/qu\157tefile"
107 index
0000000..d95f3ad
114 test_expect_success
'apply --directory (quoted filename)' '
115 git reset --hard initial &&
116 git apply --directory=some/sub/dir/ --index patch &&
117 echo content >expect &&
118 git show :some/sub/dir/quotefile >actual &&
119 test_cmp expect actual &&
120 test_cmp expect some/sub/dir/quotefile