git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] checkout: die() on ambiguous tracking branches

From
AMAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Date
Dec 5, 2019, 15:34 UTC
Message-ID
<065c02a7-8ef9-192b-097e-57913db05520@syntevo.com>
In-Reply-To
<08b8acc1-6925-ad40-faa2-88a16b8d135f@syntevo.com>
Ævar, please let me know if your concern is resolved?
On 27.11.2019 17:09, Alexandr Miloslavskiy wrote:
Show 57 quoted lines
> 
> 
> On 27.11.2019 16:43, Ævar Arnfjörð Bjarmason wrote:
>> I'll reserve judgement on whether we really should do this for now, my
>> current opinion on the matter is undefined as I haven't re-paged this
>> behavior of checkout into my brain.
>>
>> But a giant red flag here for me is that you say "I understand that this
>> was never intended".
>>
>> Just from a cursory look at this that's not true, for better or worse it
>> *is* intended behavior. Most of the code you're moving around here is
>> what I added in ad8d5104b4 ("checkout: add advice for ambiguous
>> "checkout <branch>"", 2018-06-05), and the very start of that commit
>> message refers to the checkout documentation we have that explicitly
>> documents this edge case.
>>
>> Digging a bit further reveals that we've had this behavior (again,
>> intended, not emergent) since 70c9ac2f19 ("DWIM "git checkout frotz" to
>> "git checkout -b frotz origin/frotz"", 2009-10-18), and had it
>> documented since 00bb4378c7 ("Documentation/git-checkout.txt: document
>> 70c9ac2 behavior", 2012-12-17).
>>
>> So at the very least I'd say you need a v2 where you amend the relevant
>> docs & commit message to make a case to the effect of "we've had this
>> since 2009, but it was never really all that important etc.".
>>
> 
> I'm sorry, can you please clarify?
> 
> My patch addresses the situation where there are *multiple* remote 
> candidates *and* a file with the same name.
> 
> My feeling is that in this case, reverting a file is an unintended 
> surprise.
> 
> I understand previous patches this way:
> ad8d5104 - patch series is mostly for "if there are *multiple* remotes,
>             disambiguate via checkout.defaultRemote". This essentially
>             converts the case of multiple remotes into a single remote.
>             However, this also semi-documents what I'm now preventing.
>             Was that really intended?
> 70c9ac2f - if there is *one* remote, DWIM it.
>             This isn't what I'm changing.
> be4908f1 - if there is *one* remote *and* file, die().
>             This is what I'm extending further.
> 
> If the prevented behavior is documented, could you please quote it 
> explicitly?
> 
>> Such a change should also be changing the docs etc. added in 8d7b558bae
>> ("checkout & worktree: introduce checkout.defaultRemote",
>> 2018-06-05). With this series our docs don't make a lot of sense anymore
>> & don't describe the behavior with the patches applied.
> 
> To my understanding, my patch doesn't affect those pieces of docs? 
> Please correct me if I'm wrong.
Previous: Alexandr MiloslavskiyNext: Alexandr Miloslavskiy via GitGitGadget
Message 8 of 13 in “checkout: die() on ambiguous tracking branches”
  1. 0/2 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  2. 1/2 parse_branchname_arg(): extract part as new functionAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  3. 2/2 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  4. Derrick StoleeNov 27, 2019
  5. Alexandr MiloslavskiyNov 27, 2019
  6. Ævar Arnfjörð BjarmasonNov 27, 2019
  7. Alexandr MiloslavskiyNov 27, 2019
  8. Alexandr MiloslavskiyDec 5, 2019
  9. 0/2 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  10. 2/2 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  11. 1/2 parse_branchname_arg(): extract part as new functionAlexandr Miloslavskiy via GitGitGadget, Nov 27, 2019
  12. Junio C HamanoDec 1, 2019
  13. Alexandr MiloslavskiyDec 1, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.