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)' '
28 git apply --directory=some/sub -p3 --index patch &&
29 test Bello = $(git show :some/sub/dir/file) &&
30 test Bello = $(cat some/sub/dir/file)
34 test_expect_success
'apply --directory -p (2) ' '
36 git reset --hard initial &&
37 git apply --directory=some/sub/ -p3 --index patch &&
38 test Bello = $(git show :some/sub/dir/file) &&
39 test Bello = $(cat some/sub/dir/file)
44 diff --git a/newfile b/newfile
46 index 0000000..d95f3ad
53 test_expect_success
'apply --directory (new file)' '
54 git reset --hard initial &&
55 git apply --directory=some/sub/dir/ --index patch &&
56 test content = $(git show :some/sub/dir/newfile) &&
57 test content = $(cat some/sub/dir/newfile)
61 diff --git a/c/newfile2 b/c/newfile2
63 index 0000000..d95f3ad
70 test_expect_success
'apply --directory -p (new file)' '
71 git reset --hard initial &&
72 git apply -p2 --directory=some/sub/dir/ --index patch &&
73 test content = $(git show :some/sub/dir/newfile2) &&
74 test content = $(cat some/sub/dir/newfile2)
78 diff --git a/delfile b/delfile
79 deleted file mode 100644
80 index d95f3ad..0000000
87 test_expect_success
'apply --directory (delete file)' '
88 git reset --hard initial &&
89 echo content >some/sub/dir/delfile &&
90 git add some/sub/dir/delfile &&
91 git apply --directory=some/sub/dir/ --index patch &&
92 ! (git ls-files | grep delfile)
96 diff --git "a/qu\157tefile" "b/qu\157tefile"
98 index
0000000..d95f3ad
105 test_expect_success
'apply --directory (quoted filename)' '
106 git reset --hard initial &&
107 git apply --directory=some/sub/dir/ --index patch &&
108 test content = $(git show :some/sub/dir/quotefile) &&
109 test content = $(cat some/sub/dir/quotefile)