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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 27, 2023 at 1:50 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Whichever phrasing you end up using, I think the order of messages
> should be made consistent between the two cases.  That is,
>
> > 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.

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.

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.)



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux