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

Allow one-way tree merge to remove old files

From
Linus Torvalds <torvalds@osdl.org>
Date
May 14, 2006, 17:43 UTC
Message-ID
<Pine.LNX.4.64.0605141040210.3866@g5.osdl.org>

For some random reason (probably just because nobody noticed), the one-way merge strategy didn't mark deleted files as deleted, so if you used

	git-read-tree -m -u <newtree>

it would update the files that got changed in the index, but it would not delete the files that got deleted.

This should fix it, and I can't imagine that anybody depends on the old strange "update only existing files" behaviour.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/read-tree.c b/read-tree.c
index e926e4c..11157f4 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -684,7 +684,7 @@ static int oneway_merge(struct cache_ent
 			     merge_size);
 
 	if (!a)
-		return 0;
+		return deleted_entry(old, NULL);
 	if (old && same(old, a)) {
 		return keep_entry(old);
 	}
Next: Junio C Hamano
Message 1 of 8 in “Allow one-way tree merge to remove old files”
  1. Linus TorvaldsMay 14, 2006
  2. Junio C HamanoMay 14, 2006
  3. Simplify "git reset --hard"Linus Torvalds, May 14, 2006
  4. Junio C HamanoMay 15, 2006
  5. Junio C HamanoMay 15, 2006
  6. Junio C HamanoMay 15, 2006
  7. Linus TorvaldsMay 15, 2006
  8. Linus TorvaldsMay 15, 2006

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.