diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:54 -0800 |
commit | 0669bdf4ebc095a2b26654292e1ff38245ccf88a (patch) | |
tree | e1cbee05b782fabade7aefc3767ffdbf28f75dfd /t/t3200-branch.sh | |
parent | Merge branch 'ab/usage-die-message' (diff) | |
parent | config: require lowercase for branch.*.autosetupmerge (diff) | |
download | tgif-0669bdf4ebc095a2b26654292e1ff38245ccf88a.tar.xz |
Merge branch 'js/branch-track-inherit'
"git -c branch.autosetupmerge=inherit branch new old" makes "new"
to have the same upstream as the "old" branch, instead of marking
"old" itself as its upstream.
* js/branch-track-inherit:
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 8a619d785e..1bc3795847 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -979,15 +979,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 @@ -1461,4 +1461,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 |