3 test_description
='apply same filename'
6 TEST_PASSES_SANITIZE_LEAK
=true
9 test_expect_success
'setup' '
11 mkdir -p some/sub/dir &&
12 echo Hello > some/sub/dir/file &&
13 git add some/sub/dir/file &&
14 git commit -m initial &&
20 diff a/bla/blub/dir/file b/bla/blub/dir/file
21 --- a/bla/blub/dir/file
22 +++ b/bla/blub/dir/file
28 test_expect_success
'apply --directory -p (1)' '
30 git apply --directory=some/sub -p3 --index patch &&
31 test Bello = $(git show :some/sub/dir/file) &&
32 test Bello = $(cat 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 &&
40 test Bello = $(git show :some/sub/dir/file) &&
41 test Bello = $(cat some/sub/dir/file)
46 diff --git a/newfile b/newfile
48 index 0000000..d95f3ad
55 test_expect_success
'apply --directory (new file)' '
56 git reset --hard initial &&
57 git apply --directory=some/sub/dir/ --index patch &&
58 test content = $(git show :some/sub/dir/newfile) &&
59 test content = $(cat some/sub/dir/newfile)
63 diff --git a/c/newfile2 b/c/newfile2
65 index 0000000..d95f3ad
72 test_expect_success
'apply --directory -p (new file)' '
73 git reset --hard initial &&
74 git apply -p2 --directory=some/sub/dir/ --index patch &&
75 test content = $(git show :some/sub/dir/newfile2) &&
76 test content = $(cat some/sub/dir/newfile2)
80 diff --git a/delfile b/delfile
81 deleted file mode 100644
82 index d95f3ad..0000000
89 test_expect_success
'apply --directory (delete file)' '
90 git reset --hard initial &&
91 echo content >some/sub/dir/delfile &&
92 git add some/sub/dir/delfile &&
93 git apply --directory=some/sub/dir/ --index patch &&
94 ! (git ls-files | grep delfile)
98 diff --git "a/qu\157tefile" "b/qu\157tefile"
100 index
0000000..d95f3ad
107 test_expect_success
'apply --directory (quoted filename)' '
108 git reset --hard initial &&
109 git apply --directory=some/sub/dir/ --index patch &&
110 test content = $(git show :some/sub/dir/quotefile) &&
111 test content = $(cat some/sub/dir/quotefile)