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

Re: Change in "git checkout" behaviour between 1.6.0.2 and 1.6.0.3

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2008, 19:15 UTC
Message-ID
<7vprl0oiw6.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<80r65gon3m.fsf@tiny.isode.net>
Bruce Stephens <bruce.stephens@isode.com> writes:
Show 18 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
> [...]
>
>> Bisecting gives:
>>
>>
>> 5521883490e85f4d973141972cf16f89a79f1979 is first bad commit
>> commit 5521883490e85f4d973141972cf16f89a79f1979
>> Author: Junio C Hamano <gitster@pobox.com>
>> Date:   Sun Sep 7 19:49:25 2008 -0700
>>
>>     checkout: do not lose staged removal
>
> I got the same, which is reassuring.
>
> Looks like a deliberate change with (what seems to me to be) an
> unfortunate interaction with "git clone -n"
Yeah, it was meant to allow:
	git clone -n $there $here
        cd $here
        git checkout

and was not taking care of the case to switch branches when the initial checkout is made.

Perhaps this would help.
 builtin-checkout.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git c/builtin-checkout.c w/builtin-checkout.c
index 05eee4e..d2265df 100644
--- c/builtin-checkout.c
+++ w/builtin-checkout.c
@@ -269,8 +269,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 		}
 
 		/* 2-way merge to the new branch */
-		topts.initial_checkout = (!active_nr &&
-					  (old->commit == new->commit));
+		topts.initial_checkout = !active_nr;
 		topts.update = 1;
 		topts.merge = 1;
 		topts.gently = opts->merge;

        
Previous: Bruce StephensNext: Bruce Stephens
Message 4 of 7 in “Change in "git checkout" behaviour between 1.6.0.2 and 1.6.0.3”
  1. Bruce StephensNov 12, 2008
  2. Michael J GruberNov 12, 2008
  3. Bruce StephensNov 12, 2008
  4. Junio C HamanoNov 12, 2008
  5. Bruce StephensNov 12, 2008
  6. Re* Change in "git checkout" behaviour between 1.6.0.2 and 1.6.0.3Junio C Hamano, Nov 12, 2008
  7. Bruce StephensNov 12, 2008

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.