Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:42
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] 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 <redacted>
---
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) {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help