]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4134-apply-submodule.sh
The sixth 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
8. ./test-lib.sh
9
10test_expect_success setup '
08a9dd89 11 test_oid_init &&
a48fcd83 12 cat > create-sm.patch <<EOF &&
80d706af
PC
13diff --git a/dir/sm b/dir/sm
14new file mode 160000
15index 0000000..0123456
16--- /dev/null
17+++ b/dir/sm
18@@ -0,0 +1 @@
08a9dd89 19+Subproject commit $(test_oid numeric)
80d706af
PC
20EOF
21 cat > remove-sm.patch <<EOF
22diff --git a/dir/sm b/dir/sm
23deleted file mode 160000
24index 0123456..0000000
25--- a/dir/sm
26+++ /dev/null
27@@ -1 +0,0 @@
08a9dd89 28-Subproject commit $(test_oid numeric)
80d706af
PC
29EOF
30'
31
32test_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
37'
38
39test_done