summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-18 20:31:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-18 20:31:56 (GMT)
commit6d003858e5cb82a4ac1892fa6c02604b0aa27fba (patch)
treebcb06b00caf5467023f00be159d4f03bf01ed08a /t
parente3349f288826d54ee056330222a902360c192b0b (diff)
parent5ad87271cfab6edb8eb6ad736747cd1a4f42bf83 (diff)
downloadgit-6d003858e5cb82a4ac1892fa6c02604b0aa27fba.zip
git-6d003858e5cb82a4ac1892fa6c02604b0aa27fba.tar.gz
git-6d003858e5cb82a4ac1892fa6c02604b0aa27fba.tar.bz2
Merge branch 'gc/submodule-use-super-prefix'
Another step to rewrite more parts of "git submodule" in C. * gc/submodule-use-super-prefix: submodule--helper: remove display path helper submodule--helper update: use --super-prefix submodule--helper: remove unused SUPPORT_SUPER_PREFIX flags submodule--helper: use correct display path helper submodule--helper: don't recreate recursive prefix submodule--helper update: use display path helper submodule--helper tests: add missing "display path" coverage
Diffstat (limited to 't')
-rwxr-xr-xt/t7406-submodule-update.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 06d804e..6cc0746 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -1116,4 +1116,66 @@ test_expect_success 'submodule update --filter sets partial clone settings' '
test_cmp_config -C super-filter/submodule blob:none remote.origin.partialclonefilter
'
+# NEEDSWORK: Clean up the tests so that we can reuse the test setup.
+# Don't reuse the existing repos because the earlier tests have
+# intentionally disruptive configurations.
+test_expect_success 'setup clean recursive superproject' '
+ git init bottom &&
+ test_commit -C bottom "bottom" &&
+ git init middle &&
+ git -C middle submodule add ../bottom bottom &&
+ git -C middle commit -m "middle" &&
+ git init top &&
+ git -C top submodule add ../middle middle &&
+ git -C top commit -m "top" &&
+ git clone --recurse-submodules top top-clean
+'
+
+test_expect_success 'submodule update should skip unmerged submodules' '
+ test_when_finished "rm -fr top-cloned" &&
+ cp -r top-clean top-cloned &&
+
+ # Create an upstream commit in each repo, starting with bottom
+ test_commit -C bottom upstream_commit &&
+ # Create middle commit
+ git -C middle/bottom fetch &&
+ git -C middle/bottom checkout -f FETCH_HEAD &&
+ git -C middle add bottom &&
+ git -C middle commit -m "upstream_commit" &&
+ # Create top commit
+ git -C top/middle fetch &&
+ git -C top/middle checkout -f FETCH_HEAD &&
+ git -C top add middle &&
+ git -C top commit -m "upstream_commit" &&
+
+ # Create a downstream conflict
+ test_commit -C top-cloned/middle/bottom downstream_commit &&
+ git -C top-cloned/middle add bottom &&
+ git -C top-cloned/middle commit -m "downstream_commit" &&
+ git -C top-cloned/middle fetch --recurse-submodules origin &&
+ test_must_fail git -C top-cloned/middle merge origin/main &&
+
+ # Make the update of "middle" a no-op, otherwise we error out
+ # because of its unmerged state
+ test_config -C top-cloned submodule.middle.update !true &&
+ git -C top-cloned submodule update --recursive 2>actual.err &&
+ cat >expect.err <<-\EOF &&
+ Skipping unmerged submodule middle/bottom
+ EOF
+ test_cmp expect.err actual.err
+'
+
+test_expect_success 'submodule update --recursive skip submodules with strategy=none' '
+ test_when_finished "rm -fr top-cloned" &&
+ cp -r top-clean top-cloned &&
+
+ test_commit -C top-cloned/middle/bottom downstream_commit &&
+ git -C top-cloned/middle config submodule.bottom.update none &&
+ git -C top-cloned submodule update --recursive 2>actual.err &&
+ cat >expect.err <<-\EOF &&
+ Skipping submodule '\''middle/bottom'\''
+ EOF
+ test_cmp expect.err actual.err
+'
+
test_done