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