Code

xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.
[git.git] / builtin-mv.c
index ff882bec474c59c9cb4bb49d723cf81febb204ad..54dd3bfe8ac787fda32f3557faac00c65a61de96 100644 (file)
@@ -168,13 +168,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                int j, dst_len;
 
                                if (last - first > 0) {
-                                       source = realloc(source,
+                                       source = xrealloc(source,
                                                        (count + last - first)
                                                        * sizeof(char *));
-                                       destination = realloc(destination,
+                                       destination = xrealloc(destination,
                                                        (count + last - first)
                                                        * sizeof(char *));
-                                       modes = realloc(modes,
+                                       modes = xrealloc(modes,
                                                        (count + last - first)
                                                        * sizeof(enum update_mode));
                                }
@@ -262,10 +262,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
        } else {
                for (i = 0; i < changed.nr; i++) {
                        const char *path = changed.items[i].path;
-                       int i = cache_name_pos(path, strlen(path));
-                       struct cache_entry *ce = active_cache[i];
+                       int j = cache_name_pos(path, strlen(path));
+                       struct cache_entry *ce = active_cache[j];
 
-                       if (i < 0)
+                       if (j < 0)
                                die ("Huh? Cache entry for %s unknown?", path);
                        refresh_cache_entry(ce, 0);
                }
@@ -278,6 +278,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                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) {