Code

Teach "git apply" to prepend a prefix with "--root=<root>"
[git.git] / t / t4128-apply-root.sh
1 #!/bin/sh
3 test_description='apply same filename'
5 . ./test-lib.sh
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
13 '
15 cat > patch << EOF
16 diff a/bla/blub/dir/file b/bla/blub/dir/file
17 --- a/bla/blub/dir/file
18 +++ b/bla/blub/dir/file
19 @@ -1,1 +1,1 @@
20 -Hello
21 +Bello
22 EOF
24 test_expect_success 'apply --root -p --index' '
26         git apply --root=some/sub -p3 --index patch &&
27         test Bello = $(git show :some/sub/dir/file) &&
28         test Bello = $(cat some/sub/dir/file)
30 '
32 test_done