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];