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

Re: [BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted

From
Junio C Hamano <junkio@cox.net>
Date
Oct 2, 2006, 05:05 UTC
Message-ID
<7vven3xq7l.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<750170aa0610011833n39271704q349d86af76832783@mail.gmail.com>
Thanks.  I see it reproduces.

It is a bug in git-mv that fails to update cache-tree data structure properly. This patch should fix it.

-- >8 -- git-mv: do not write out a bogus cache-tree in the index

The command updates the cache without invalidating the cache tree entries. Since this is not as performance critical as one-tree and two-tree git-read-tree and git-apply, disable use of cache-tree entirely.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/builtin-mv.c b/builtin-mv.c
index 4d21d88..9a4e2e0 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -83,6 +83,9 @@ int cmd_mv(int argc, const char **argv, 
 	if (read_cache() < 0)
 		die("index file corrupt");
 
+	/* This does not manage cache-tree properly */
+	cache_tree_free(&active_cache_tree);
+
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 
Previous: Michael CassarNext: Junio C Hamano
Message 4 of 5 in “[BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted”
  1. Michael CassarOct 1, 2006
  2. Junio C HamanoOct 1, 2006
  3. Michael CassarOct 2, 2006
  4. Junio C HamanoOct 2, 2006
  5. Junio C HamanoOct 2, 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.