2.36 fast-export regression fix
[git.git] / t / t4134-apply-submodule.sh
blobaceb4c42b0ffc7e20a0a9cc07843a953e703b269
1 #!/bin/sh
3 # Copyright (c) 2010 Peter Collingbourne
6 test_description='git apply submodule tests'
9 TEST_PASSES_SANITIZE_LEAK=true
10 . ./test-lib.sh
12 test_expect_success setup '
13 cat > create-sm.patch <<EOF &&
14 diff --git a/dir/sm b/dir/sm
15 new file mode 160000
16 index 0000000..0123456
17 --- /dev/null
18 +++ b/dir/sm
19 @@ -0,0 +1 @@
20 +Subproject commit $(test_oid numeric)
21 EOF
22 cat > remove-sm.patch <<EOF
23 diff --git a/dir/sm b/dir/sm
24 deleted file mode 160000
25 index 0123456..0000000
26 --- a/dir/sm
27 +++ /dev/null
28 @@ -1 +0,0 @@
29 -Subproject commit $(test_oid numeric)
30 EOF
33 test_expect_success 'removing a submodule also removes all leading subdirectories' '
34 git apply --index create-sm.patch &&
35 test -d dir/sm &&
36 git apply --index remove-sm.patch &&
37 test \! -d dir
40 test_done