Merge commit
bf7d128b47775e2e8d213b8ba159aeb955583e69
Merge branch 'yn/worktree-ambiguous-remote-advice'
'git checkout' and 'git worktree add' makes guesses based on a name of a remote-tracking branch, but does not give an error when such a remote-tracking branch cannot be uniquely identified, which has been corrected. * yn/worktree-ambiguous-remote-advice: worktree add: treat multiple matches with --guess-remote as an error worktree add: improve message for ambiguous remote branch name checkout: improve message for ambiguous remote branch name checkout: extract function to display advice for ambiguous remotes
Junio C Hamano <gitster@pobox.com> · 2026-09-07 16:32 UTC
Combined diff: only what this merge did beyond taking one side. Added lines are colored by the parent they came from; bold lines came from none of them; removed lines are red.
1 file changed,
+3
−2
modified builtin/worktree.c
| @@@ -897,13 -929,8 +930,11 @@@ static int add(int ac, const char **av | ||
| 930 | ||
| 931 | /* DWIM: Infer --orphan when repo has no refs. */ | |
| 932 | opts.orphan = (!s) && dwim_orphan(&opts, !!opt_track, 1); | |
| 933 | + | } else if (ac == 2 && new_branch) { |
| 934 | + | if (!strcmp(branch, "HEAD")) |
| 935 | + | can_use_local_refs(&opts); |
| 936 | } else if (ac == 2) { | |
| - | struct object_id oid; | |
| 937 | struct commit *commit; | |
| - | char *remote; | |
| 938 | ||
| 939 | commit = lookup_commit_reference_by_name(branch); | |
| 940 | if (!commit) { | |