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

Re: [PATCH] Don't update unchanged merge entries

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 16, 2008, 21:25 UTC
Message-ID
<7v1w6aico5.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.1.00.0803161413250.3020@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 9 quoted lines
> 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);
Previous: Linus Torvalds
Message 11 of 11 in “"git pull" throws away dirty state”
  1. Linus TorvaldsMar 16, 2008
  2. Linus TorvaldsMar 16, 2008
  3. Nicolas PitreMar 16, 2008
  4. Junio C HamanoMar 16, 2008
  5. Junio C HamanoMar 16, 2008
  6. Don't update unchanged merge entriesLinus Torvalds, Mar 16, 2008
  7. Daniel BarkalowMar 16, 2008
  8. Linus TorvaldsMar 16, 2008
  9. Daniel BarkalowMar 16, 2008
  10. Linus TorvaldsMar 16, 2008
  11. Junio C HamanoMar 16, 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.