]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5572-pull-submodule.sh
Sync with 2.36.3
[thirdparty/git.git] / t / t5572-pull-submodule.sh
index 069c170572ffd0bdfc8b4aea72b61cdf56907d3e..09097eff3f46033a26c9b60c94bb8cb79f3fad2c 100755 (executable)
@@ -111,6 +111,32 @@ test_expect_success " --[no-]recurse-submodule and submodule.recurse" '
        test_path_is_file super/sub/merge_strategy_4.t
 '
 
+test_expect_success "fetch.recurseSubmodules option triggers recursive fetch (but not recursive update)" '
+       test_commit -C child merge_strategy_5 &&
+       # Omit the parent commit, otherwise this passes with the
+       # default "pull" behavior.
+
+       git -C super -c fetch.recursesubmodules=true pull --no-rebase &&
+       # Check that the submodule commit was fetched
+       sub_oid=$(git -C child rev-parse HEAD) &&
+       git -C super/sub cat-file -e $sub_oid &&
+       # Check that the submodule worktree did not update
+       ! test_path_is_file super/sub/merge_strategy_5.t
+'
+
+test_expect_success "fetch.recurseSubmodules takes precedence over submodule.recurse" '
+       test_commit -C child merge_strategy_6 &&
+       # Omit the parent commit, otherwise this passes with the
+       # default "pull" behavior.
+
+       git -C super -c submodule.recurse=false -c fetch.recursesubmodules=true pull --no-rebase &&
+       # Check that the submodule commit was fetched
+       sub_oid=$(git -C child rev-parse HEAD) &&
+       git -C super/sub cat-file -e $sub_oid &&
+       # Check that the submodule worktree did not update
+       ! test_path_is_file super/sub/merge_strategy_6.t
+'
+
 test_expect_success 'pull --rebase --recurse-submodules (remote superproject submodule changes, local submodule changes)' '
        # This tests the following scenario :
        # - local submodule has new commits