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 28, 2023, 00:49 UTC
Message-ID
<xmqqpm7ohluf.fsf@gitster.g>
In-Reply-To
<CAPig+cRm1XaMzgDQZGS8vwpD_k8srQH0NGmziT_J7mtTHnR7OA@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 13 quoted lines
> There may be a misunderstanding here due to the unfortunate
> construction of Rubén's example which muddles together the output of
> `git worktree add` and `git worktree remove`. For clarity, his example
> should probably have been written:
>
>   $ git worktree add test --detach
>   Preparing worktree (detached HEAD 2efe05c)
>   HEAD is now at 2efe05c commit-a
>   $ git worktree remove test
>   HEAD position was 2efe05c commit-a
>
> although showing only the `git worktree remove` command would probably
> have been even clearer.
Ah, you are absolutely right.

My "huh?" against the apparent inconsistency between "checkout" and "worktree" regarding the order of "this is the end result" vs "this is what we left behind" does not exist, as "worktree remove" does not involve being newly on a detached HEAD and it is the one that may introduce a newly abandoned line of history. So everything makes sense.

Show 13 quoted lines
> Such example output does a good job of arguing in favor of your
> suggestion to use phrasing which is more alarming:
>
>   $ git checkout -
>   Commit 2efe05c "commit-a" left dangling
>   HEAD is now at 7906992 commit-b
>
>   $ git worktree remove test
>   Commit 2efe05c "commit-a" left dangling
>
> (Hopefully someone can come up with better wording than "About to lose
> history leading to" and "Commit ... left dangling", neither of which
> sound quite right.)

Yup, I am obviously worse at phrasing this than you are ;-) We'd need a good wording that is alarming, even for those who squelch most of the warning given via the advise system, without becoming too verbose.

Thanks.
Previous: Eric SunshineNext: Rubén Justo
Message 8 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.