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

Re: [PATCH 2/3] worktree: warn when removing a worktree with orphan commits

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 27, 2023, 05:46 UTC
Message-ID
<xmqqwn1xnahy.fsf@gitster.g>
In-Reply-To
<51adbbcb-bbfa-58cc-03a4-82809c0c555e@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 5 quoted lines
> Maybe "HEAD position was" fits for both usages.  This is how it would
> look like:
> ...
> I think, if there are no objections or better suggestions, I'll re-roll
> with "HEAD was at". 

But does it convey the more important point? The reason why "HEAD WAS at" may matter is because the user is about to lose history leading to it. I wonder if we want to be more direct and alarming, e.g.

    $ git checkout -
    About to lose history leading to 2efe05c commit-a
    HEAD is now at 7906992 commit-b

Whichever phrasing you end up using, I think the order of messages should be made consistent between the two cases. That is,

Show 6 quoted lines
> Maybe "HEAD position was" fits for both usages.  This is how it would
> look like:
>
>    $ git checkout -
>    HEAD position was 7906992 commit-b
>    HEAD is now at 2efe05c commit-a
Here "git checkout" reports the lost HEAD and then the end result.
>    $ git worktree add test --detach && git worktree remove test
>    Preparing worktree (detached HEAD 2efe05c)
>    HEAD is now at 2efe05c commit-a
>    HEAD position was 2efe05c commit-a

But here "git worktree add" reports the end resultfirst and then reports the lost HEAD. It probably should report them in reverse.

Thanks.
Previous: Rubén JustoNext: Eric Sunshine
Message 6 of 12 in “warn when unreachable commits are left behind”
  1. 0/3 warn when unreachable commits are left behindRubén Justo, Apr 22, 2023
  2. 1/3 checkout: move orphaned_commit_warning()Rubén Justo, Apr 22, 2023
  3. 2/3 worktree: warn when removing a worktree with orphan commitsRubén Justo, Apr 22, 2023
  4. Junio C HamanoApr 24, 2023
  5. Rubén JustoApr 26, 2023
  6. Junio C HamanoApr 27, 2023
  7. Eric SunshineApr 27, 2023
  8. Junio C HamanoApr 28, 2023
  9. Rubén JustoApr 27, 2023
  10. 3/3 checkout: warn when unreachable commits after using --orphanRubén Justo, Apr 22, 2023
  11. Andrei RybakApr 27, 2023
  12. Rubén JustoApr 27, 2023

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.