You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before this patch, when there were multiple DWIM candidates for remote
branch, git decided to try the argument as pathspec instead. I believe
that such behavior is a surprise: adding another remote suddenly causes
git to discard file contents, because it was unsure which branch to
pick. There was an incomplete attempt to prevent that in [3].
I understand that this was never intended:
[1] introduces the unexpected behavior. Before, there was fallback
from not-a-ref to pathspec. This is reasonable DWIM. After, there is
another fallback from ambiguous-remote to pathspec. I understand that
it was kind of copy&paste oversight.
[2] noticed the unexpected behavior but chose to semi-document it
instead of forbidding, because the goal of the patch series was
focused on something else.
[3] adds `die()` when there is ambiguity between branch and file. The
case of multiple tracking branches is seemingly overlooked.
Change to complain about ambiguity instead of doing unexpected things.
[1] Commit 70c9ac2 ("DWIM "git checkout frotz" to "git checkout -b frotz origin/frotz"" 2009-10-18)
https://public-inbox.org/git/[email protected]/
[2] Commit ad8d510 ("checkout: add advice for ambiguous "checkout <branch>"", 2018-06-05)
https://public-inbox.org/git/[email protected]/
[3] Commit be4908f ("checkout: disambiguate dwim tracking branches and local files", 2018-11-13)
https://public-inbox.org/git/[email protected]/
Signed-off-by: Alexandr Miloslavskiy <[email protected]>
0 commit comments