]>
Commit | Line | Data |
---|---|---|
80d706af PC |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2010 Peter Collingbourne | |
4 | # | |
5 | ||
6 | test_description='git apply submodule tests' | |
7 | ||
f54f48fc ÆAB |
8 | |
9 | TEST_PASSES_SANITIZE_LEAK=true | |
80d706af PC |
10 | . ./test-lib.sh |
11 | ||
12 | test_expect_success setup ' | |
a48fcd83 | 13 | cat > create-sm.patch <<EOF && |
80d706af PC |
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 @@ | |
08a9dd89 | 20 | +Subproject commit $(test_oid numeric) |
80d706af PC |
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 @@ | |
08a9dd89 | 29 | -Subproject commit $(test_oid numeric) |
80d706af PC |
30 | EOF |
31 | ' | |
32 | ||
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 | |
38 | ' | |
39 | ||
40 | test_done |