git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Xavier Maillard <zedek@gnu.org>,
	Jakub Narebski <jnareb@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] checkout -d: explicitly detach HEAD even when switching to the tip of a branch
Date: Tue, 3 Apr 2007 18:55:03 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0704031850240.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <7vtzvxt2v3.fsf@assigned-by-dhcp.cox.net>



On Tue, 3 Apr 2007, Junio C Hamano wrote:
> 
> Could anybody remind me why we have the "new != old" check here?

Afaik, it's just so that you can do

	git checkout -f

without having it complain. And I think it just comes from the earlier:

	[ -z "$new" ] && new=$old && new_name="$old_name"

that we did - ie without that it would incorrectly just overwrite the 
current working tree with the new commit, but not actually do the "git 
reset" part.

So without that check, the way things used to work (*before* detached 
heads), if you were to have done

	git checkout <some-random-head>

it would have screwed up the current branch horribly.

With detached heads, I don't think it's needed.

		Linus

      reply	other threads:[~2007-04-04  1:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-29  8:02 [PATCH] checkout -d: explicitly detach HEAD even when switching to the tip of a branch Junio C Hamano
2007-03-29 10:44 ` Xavier Maillard
2007-03-29 17:10   ` Alex Riesen
2007-03-29 20:54     ` Xavier Maillard
2007-03-31  0:11 ` Jakub Narebski
2007-03-31 14:55   ` Xavier Maillard
2007-04-04  0:11     ` Junio C Hamano
2007-04-04  1:55       ` Linus Torvalds [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0704031850240.6730@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=junkio@cox.net \
    --cc=zedek@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).