#!/bin/sh # # Copyright (c) 2010 Peter Collingbourne # global test_description := ''git apply submodule tests'' source ./test-lib.sh test_expect_success setup ' cat > create-sm.patch < remove-sm.patch <)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tcat > create-sm.patch < <"diff --git a/dir/sm b/dir/sm\n"> <"new file mode 160000\n"> <"index 0000000..0123456\n"> <"--- /dev/null\n"> <"+++ b/dir/sm\n"> <"@@ -0,0 +1 @@\n"> <"+Subproject commit 0123456789abcdef0123456789abcdef01234567\n"> <"EOF\n"> <"\tcat > remove-sm.patch < <"diff --git a/dir/sm b/dir/sm\n"> <"deleted file mode 160000\n"> <"index 0123456..0000000\n"> <"--- a/dir/sm\n"> <"+++ /dev/null\n"> <"@@ -1 +0,0 @@\n"> <"-Subproject commit 0123456789abcdef0123456789abcdef01234567\n"> <"EOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing a submodule also removes all leading subdirectories">)} { (SQ <"\n"> <"\tgit apply --index create-sm.patch &&\n"> <"\ttest -d dir/sm &&\n"> <"\tgit apply --index remove-sm.patch &&\n"> <"\ttest \\! -d dir\n"> ) } ) (C {(test_done)}) ] )