diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-04-04 10:56:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-04 10:56:24 -0700 |
commit | ba2452b247dfd455bccbcb04acdcfd142cb5397e (patch) | |
tree | c026f02a9e732ccbb6b5fd94b58955e7aa7d7abd /t | |
parent | Merge branch 'rc/fetch-refetch' (diff) | |
parent | tracking branches: add advice to ambiguous refspec error (diff) | |
download | tgif-ba2452b247dfd455bccbcb04acdcfd142cb5397e.tar.xz |
Merge branch 'tk/ambiguous-fetch-refspec'
Give hint when branch tracking cannot be established because fetch
refspecs from multiple remote repositories overlap.
* tk/ambiguous-fetch-refspec:
tracking branches: add advice to ambiguous refspec error
Diffstat (limited to 't')
-rwxr-xr-x | t/t3200-branch.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 7a0ff75ba8..e12db59361 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -1039,13 +1039,27 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates git rev-parse --verify gamma@{0} ' -test_expect_success 'avoid ambiguous track' ' +test_expect_success 'avoid ambiguous track and advise' ' git config branch.autosetupmerge true && git config remote.ambi1.url lalala && git config remote.ambi1.fetch refs/heads/lalala:refs/heads/main && git config remote.ambi2.url lilili && git config remote.ambi2.fetch refs/heads/lilili:refs/heads/main && - test_must_fail git branch all1 main && + cat <<-EOF >expected && + fatal: not tracking: ambiguous information for ref '\''refs/heads/main'\'' + hint: There are multiple remotes whose fetch refspecs map to the remote + hint: tracking ref '\''refs/heads/main'\'': + hint: ambi1 + hint: ambi2 + hint: '' + hint: This is typically a configuration error. + hint: '' + hint: To support setting up tracking branches, ensure that + hint: different remotes'\'' fetch refspecs map into different + hint: tracking namespaces. + EOF + test_must_fail git branch all1 main 2>actual && + test_cmp expected actual && test -z "$(git config branch.all1.merge)" ' |