Merge branch 'hs/simplify-bit-setting-in-fsck-tree'
[gitweb.git] / builtin / mv.c
index 7e26eb5229a0c8a526314cecb9860c3dfb0fed00..2a7243f52e413c821f9f75969edcc0a9822c8e21 100644 (file)
@@ -180,6 +180,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                                modes = xrealloc(modes,
                                                                (argc + last - first)
                                                                * sizeof(enum update_mode));
+                                               submodule_gitfile = xrealloc(submodule_gitfile,
+                                                               (argc + last - first)
+                                                               * sizeof(char *));
                                        }
 
                                        dst = add_slash(dst);
@@ -193,6 +196,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                                        prefix_path(dst, dst_len,
                                                                path + length + 1);
                                                modes[argc + j] = INDEX;
+                                               submodule_gitfile[argc + j] = NULL;
                                        }
                                        argc += last - first;
                                }
@@ -228,6 +232,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                        memmove(destination + i,
                                                destination + i + 1,
                                                (argc - i) * sizeof(char *));
+                                       memmove(modes + i, modes + i + 1,
+                                               (argc - i) * sizeof(enum update_mode));
+                                       memmove(submodule_gitfile + i,
+                                               submodule_gitfile + i + 1,
+                                               (argc - i) * sizeof(char *));
                                        i--;
                                }
                        } else