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

Re: [PATCH 2/2] checkout (detached): truncate list of orphaned commits at the new HEAD

From
Jeff King <peff@peff.net>
Date
May 5, 2012, 09:01 UTC
Message-ID
<20120505090108.GA8172@sigill.intra.peff.net>
In-Reply-To
<4FA41C98.2010105@kdbg.org>
On Fri, May 04, 2012 at 08:14:48PM +0200, Johannes Sixt wrote:
Show 11 quoted lines
> When git checkout switches from a detached HEAD to any other commit, then
> all orphaned commits were listed in a warning:
> 
>   Warning: you are leaving 2 commits behind...:
> 
>     a5e5396 another fixup
>     6aa1af6 fixup foo
> 
> But if the new commit is actually one from this list (6aa1af6 in this
> example), then the list in the warning can be truncated at the new HEAD,
> because history beginning at HEAD is not "left behind". This makes it so.

Thanks, this has bugged me a few times in the past, but I've never gotten around to investigating and fixing it.

>  builtin/checkout.c         | 13 +++++++------
>  t/t2020-checkout-detach.sh |  2 +-
>  2 files changed, 8 insertions(+), 7 deletions(-)
The patch looks right to me.
-Peff
Previous: Junio C Hamano
Message 4 of 4 in “t2020-checkout-detach: check for the number of orphaned commits”
  1. 1/2 t2020-checkout-detach: check for the number of orphaned commitsJohannes Sixt, May 4, 2012
  2. 2/2 checkout (detached): truncate list of orphaned commits at the new HEADJohannes Sixt, May 4, 2012
  3. Junio C HamanoMay 4, 2012
  4. Jeff KingMay 5, 2012

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.