tvl-depot/third_party/git/t/t4134-apply-submodule.sh
Vincent Ambo f4609b896f merge(3p/git): Merge git subtree at v2.29.2
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because
there is some breakage in the git build related to the netrc
credentials helper which someone has taken care of in nixpkgs.

The stable channel is not used for anything other than git, so this
should be fine.

Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
2020-11-21 19:45:56 +01:00

38 lines
738 B
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2010 Peter Collingbourne
#
test_description='git apply submodule tests'
. ./test-lib.sh
test_expect_success setup '
cat > create-sm.patch <<EOF &&
diff --git a/dir/sm b/dir/sm
new file mode 160000
index 0000000..0123456
--- /dev/null
+++ b/dir/sm
@@ -0,0 +1 @@
+Subproject commit $(test_oid numeric)
EOF
cat > remove-sm.patch <<EOF
diff --git a/dir/sm b/dir/sm
deleted file mode 160000
index 0123456..0000000
--- a/dir/sm
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit $(test_oid numeric)
EOF
'
test_expect_success 'removing a submodule also removes all leading subdirectories' '
git apply --index create-sm.patch &&
test -d dir/sm &&
git apply --index remove-sm.patch &&
test \! -d dir
'
test_done