git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Cláudio Lourenço" <pt.smooke@gmail.com>,
	Leila <muhtasib@gmail.com>,
	konglu@minatec.inpg.fr, git@vger.kernel.org,
	"Renato Neves" <nevrenato@gmail.com>
Subject: Re: Help understanding git checkout behavior
Date: Mon, 11 Jun 2012 17:47:05 -0400	[thread overview]
Message-ID: <20120611214705.GC32061@sigill.intra.peff.net> (raw)
In-Reply-To: <7vk3zd5y8d.fsf@alter.siamese.dyndns.org>

On Mon, Jun 11, 2012 at 02:34:42PM -0700, Junio C Hamano wrote:

> So there are two paths involved in this two-way merge.
> 
> The master branch (HEAD) has "something", but not "something/f1".
> The index does not have "something", but has "something/f1".
> The "b" branch does not have either.
> 
> For path "something", the rule 2 in the "Two Tree Merge" section of
> Documentation/git-read-tree.txt applies.  It does not exist in the
> index, it does exist in HEAD, and it does not exist in the other
> branch we are checking out.  The result should be to remove it.
> 
> For path "something/f1", the rule 4 ought to apply.  The index entry
> for it is up to date with respect to the working tree file
> (i.e. clean), the HEAD does not have it, and the other branch does
> not have it either.  We should be keeping it intact across the
> checkout.  For whatever reason, this is not happening and I suspect
> that is because we have to remove "something" due to rule 2.

I think the problem is in verify_clean_subdirectory, which checks that
we do not have untracked files in the subdirectory, nor modifications
between the index and working tree. But I do not see it checking whether
we have modifications from the HEAD.

> I just checked the history of unpack-trees code (which is the
> underlying machinery of read-tree, which in turn is the machinery
> used to check out another branch by "git checkout"), and I suspect
> that this particular case has never worked.

Yeah, I verified it back to v1.6.x, but didn't bother going further
back.

-Peff

  reply	other threads:[~2012-06-11 21:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11 16:52 Help understanding git checkout behavior Cláudio Lourenço
2012-06-11 17:07 ` Konstantin Khomoutov
2012-06-11 18:21 ` konglu
2012-06-11 18:34   ` Leila
2012-06-11 18:55     ` Jeff King
2012-06-11 18:56     ` Junio C Hamano
2012-06-11 20:48       ` Cláudio Lourenço
2012-06-11 21:04         ` Junio C Hamano
2012-06-11 21:34           ` Junio C Hamano
2012-06-11 21:47             ` Jeff King [this message]
2012-06-11 21:58               ` Jeff King
2012-06-11 22:45               ` Junio C Hamano
2012-06-11 18:52 ` Vincent van Ravesteijn

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=20120611214705.GC32061@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=konglu@minatec.inpg.fr \
    --cc=muhtasib@gmail.com \
    --cc=nevrenato@gmail.com \
    --cc=pt.smooke@gmail.com \
    /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).