diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-31 10:37:44 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-31 10:37:44 -0800 |
commit | 09e0be130d83ceedb3653d9a41768c6a13457ac5 (patch) | |
tree | 466600cb071233316506ff31a3e9966679fb2908 /t/t3200-branch.sh | |
parent | abe6bb3905392d5eb6b01fa6e54d7e784e0522aa (diff) | |
parent | 6327f0efed36c64d98a140110171362b7cb75a52 (diff) | |
download | git-09e0be130d83ceedb3653d9a41768c6a13457ac5.tar.gz |
Merge branch 'js/branch-track-inherit' into gc/branch-recurse-submodules
* js/branch-track-inherit:
branch,checkout: fix --track documentation
branch,checkout: fix --track usage strings
config: require lowercase for branch.*.autosetupmerge
branch: add flags and config to inherit tracking
branch: accept multiple upstream branches for tracking
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-x | t/t3200-branch.sh | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 8c5c1ccf33..09ab132377 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -972,15 +972,15 @@ test_expect_success 'disabled option --set-upstream fails' ' test_must_fail git branch --set-upstream origin/main ' -test_expect_success '--set-upstream-to notices an error to set branch as own upstream' ' +test_expect_success '--set-upstream-to notices an error to set branch as own upstream' " git branch --set-upstream-to refs/heads/my13 my13 2>actual && cat >expect <<-\EOF && - warning: Not setting branch my13 as its own upstream. + warning: not setting branch 'my13' as its own upstream. EOF test_expect_code 1 git config branch.my13.remote && test_expect_code 1 git config branch.my13.merge && test_cmp expect actual -' +" # Keep this test last, as it changes the current branch cat >expect <<EOF @@ -1454,4 +1454,37 @@ test_expect_success 'invalid sort parameter in configuration' ' ) ' +test_expect_success 'tracking info copied with --track=inherit' ' + git branch --track=inherit foo2 my1 && + test_cmp_config local branch.foo2.remote && + test_cmp_config refs/heads/main branch.foo2.merge +' + +test_expect_success 'tracking info copied with autoSetupMerge=inherit' ' + test_unconfig branch.autoSetupMerge && + # default config does not copy tracking info + git branch foo-no-inherit my1 && + test_cmp_config "" --default "" branch.foo-no-inherit.remote && + test_cmp_config "" --default "" branch.foo-no-inherit.merge && + # with autoSetupMerge=inherit, we copy tracking info from my1 + test_config branch.autoSetupMerge inherit && + git branch foo3 my1 && + test_cmp_config local branch.foo3.remote && + test_cmp_config refs/heads/main branch.foo3.merge && + # no tracking info to inherit from main + git branch main2 main && + test_cmp_config "" --default "" branch.main2.remote && + test_cmp_config "" --default "" branch.main2.merge +' + +test_expect_success '--track overrides branch.autoSetupMerge' ' + test_config branch.autoSetupMerge inherit && + git branch --track=direct foo4 my1 && + test_cmp_config . branch.foo4.remote && + test_cmp_config refs/heads/my1 branch.foo4.merge && + git branch --no-track foo5 my1 && + test_cmp_config "" --default "" branch.foo5.remote && + test_cmp_config "" --default "" branch.foo5.merge +' + test_done |