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

Re: New orphan worktree?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2021, 18:14 UTC
Message-ID
<xmqq7dmy4pox.fsf@gitster.g>
In-Reply-To
<87a6rv82n3.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 12 quoted lines
>> I see where you're coming from in viewing --orphan as a modifier of
>> branch creation rather than as a branch-creation option itself.
>> However, as far as UI is concerned, that ship sailed a long time ago,
>> I suppose.
>
> Not really, I think we can have a new-style of it and just say:
>
>     It is also possible to provide `--orphan <branch-name>`, but
>     supplying it as an option to `-[cC]` as `-[cC] <branch-name>
>     --orphan` is preferred these days.
>
> Whether we should is another matter, see below...

We cannot affored to give it a short-and-sweet "-[oO]", but if we could, we probably would have, and that would have made the UI consistent, at least (in other words, I'd see the act of creating an "orphan" branch something distinct from creation of a normal branch).

"You can treat --orphan as a standalone and distinct request to create this specific kind of branch, or you can treat as if it is just a modifier to specify which kind of branch, and -c/-C is still used to ask for creation or forced update" does not sound like a very end-user friendly explanation, at least to me. Extra choices that do not make a real difference invites "so, which should I use?", a question they do not have to ask.

Show 9 quoted lines
>>> I think not having a -B or -C equivalent at all would be preferrable to
>>> having a --force special-case just to work around the lack of it for
>>> --orphan.
>>
>> I'm having trouble wrapping my brain around this statement.
>
> I mean I'd rather not have an --orphan mode that works like -B (as
> opposed to -b) at all instead of having one that's "--orphan
> --force-ref-deletion" or whatever.
If you are saying that we should just have
    -c/-b/--orphan
    -c/-b/--orphan --force
    -C/-B (synonym for -c/-b --force)

then I fully agree. I think the uppercase ones (and "git branch -d/-D") were mistakes and should have used --force instead.

> It's an obscure enough thing that I don't think anyone *really* cares. I
> just wanted to find out if it not being a boolean was intentional, or a
> historical accident we would consider fixing if there was further work
> on it.
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 16 of 22 in “New orphan worktree?”
  1. Stefan MonnierJan 6, 2021
  2. Jim HillJan 6, 2021
  3. Elijah NewrenJan 6, 2021
  4. Jim HillJan 6, 2021
  5. Elijah NewrenJan 6, 2021
  6. Eric SunshineJan 6, 2021
  7. Ævar Arnfjörð BjarmasonFeb 18, 2021
  8. Eric SunshineFeb 21, 2021
  9. Ævar Arnfjörð BjarmasonFeb 22, 2021
  10. Eric SunshineFeb 22, 2021
  11. Junio C HamanoFeb 22, 2021
  12. Eric SunshineFeb 23, 2021
  13. Ævar Arnfjörð BjarmasonFeb 23, 2021
  14. Eric SunshineFeb 23, 2021
  15. Ævar Arnfjörð BjarmasonFeb 23, 2021
  16. Junio C HamanoFeb 23, 2021
  17. Junio C HamanoJan 6, 2021
  18. Jim HillJan 6, 2021
  19. Junio C HamanoJan 6, 2021
  20. Jim HillJan 6, 2021
  21. Stefan MonnierJan 6, 2021
  22. Stefan MonnierJan 6, 2021

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.