Merge branch 'jc/exclusion-doc'
[alt-git.git] / t / t4134-apply-submodule.sh
blob0043930ca6ab31f6cd6a0bf6464ceb281663f9e8
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 cat > create-sm.patch <<EOF &&
12 diff --git a/dir/sm b/dir/sm
13 new file mode 160000
14 index 0000000..0123456
15 --- /dev/null
16 +++ b/dir/sm
17 @@ -0,0 +1 @@
18 +Subproject commit 0123456789abcdef0123456789abcdef01234567
19 EOF
20 cat > remove-sm.patch <<EOF
21 diff --git a/dir/sm b/dir/sm
22 deleted file mode 160000
23 index 0123456..0000000
24 --- a/dir/sm
25 +++ /dev/null
26 @@ -1 +0,0 @@
27 -Subproject commit 0123456789abcdef0123456789abcdef01234567
28 EOF
31 test_expect_success 'removing a submodule also removes all leading subdirectories' '
32 git apply --index create-sm.patch &&
33 test -d dir/sm &&
34 git apply --index remove-sm.patch &&
35 test \! -d dir
38 test_done