]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4134-apply-submodule.sh
The third batch
[thirdparty/git.git] / t / t4134-apply-submodule.sh
CommitLineData
80d706af
PC
1#!/bin/sh
2#
3# Copyright (c) 2010 Peter Collingbourne
4#
5
6test_description='git apply submodule tests'
7
f54f48fc
ÆAB
8
9TEST_PASSES_SANITIZE_LEAK=true
80d706af
PC
10. ./test-lib.sh
11
12test_expect_success setup '
a48fcd83 13 cat > create-sm.patch <<EOF &&
80d706af
PC
14diff --git a/dir/sm b/dir/sm
15new file mode 160000
16index 0000000..0123456
17--- /dev/null
18+++ b/dir/sm
19@@ -0,0 +1 @@
08a9dd89 20+Subproject commit $(test_oid numeric)
80d706af
PC
21EOF
22 cat > remove-sm.patch <<EOF
23diff --git a/dir/sm b/dir/sm
24deleted file mode 160000
25index 0123456..0000000
26--- a/dir/sm
27+++ /dev/null
28@@ -1 +0,0 @@
08a9dd89 29-Subproject commit $(test_oid numeric)
80d706af
PC
30EOF
31'
32
33test_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
38'
39
40test_done