All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Don't update unchanged merge entries
Date: Sun, 16 Mar 2008 14:25:46 -0700	[thread overview]
Message-ID: <7v1w6aico5.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0803161413250.3020@woody.linux-foundation.org> (Linus Torvalds's message of "Sun, 16 Mar 2008 14:15:10 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Sun, 16 Mar 2008, Daniel Barkalow wrote:
>> 
>> Well, the top part of the comment suggests that this is just an 
>> optimization (don't bother to write out a file that you know is 
>> unchanged), when it's actually necessary for correctness (since we don't 
>> know if the working tree matches the old index).
>
> Ahh, that part. Yeah, maybe we could expand/clarify it. I don't think the 
> comment is wrong per se, but yes, I'm sure it could be improved. 

Will squash this in (together with the test updates I sent out earlier).

 unpack-trees.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index a72ac03..4b359e0 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -602,8 +602,8 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
 		 * See if we can re-use the old CE directly?
 		 * That way we get the uptodate stat info.
 		 *
-		 * This also removes the UPDATE flag on
-		 * a match.
+		 * This also removes the UPDATE flag on a match; otherwise
+		 * we will end up overwriting local changes in the work tree.
 		 */
 		if (same(old, merge)) {
 			copy_cache_entry(merge, old);

      reply	other threads:[~2008-03-16 21:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 18:08 "git pull" throws away dirty state Linus Torvalds
2008-03-16 18:24 ` Linus Torvalds
2008-03-16 18:37   ` Nicolas Pitre
2008-03-16 20:50     ` Junio C Hamano
2008-03-16 21:13       ` Junio C Hamano
2008-03-16 18:42   ` [PATCH] Don't update unchanged merge entries Linus Torvalds
2008-03-16 20:00     ` Daniel Barkalow
2008-03-16 20:40       ` Linus Torvalds
2008-03-16 21:10         ` Daniel Barkalow
2008-03-16 21:15           ` Linus Torvalds
2008-03-16 21:25             ` Junio C Hamano [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=7v1w6aico5.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.