From: Junio C Hamano Date: Mon, 02 Oct 2006 05:20:13 GMT Subject: Re: [BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted Message-ID: <7vmz8fxpiq.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <7vven3xq7l.fsf@assigned-by-dhcp.cox.net> Junio C Hamano writes: > 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. The previous patch was safer but unnecessarily was a bit heavy handed. This should fix it nicer. -- >8 -- git-mv: invalidate the removed path properly in cache-tree The command updated the cache without invalidating the cache tree entries while removing an existing entry. Signed-off-by: Junio C Hamano --- diff --git a/builtin-mv.c b/builtin-mv.c index 4d21d88..54dd3bf 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -278,6 +278,7 @@ int cmd_mv(int argc, const char **argv, for (i = 0; i < deleted.nr; i++) { const char *path = deleted.items[i].path; remove_file_from_cache(path); + cache_tree_invalidate_path(active_cache_tree, path); } if (active_cache_changed) {