Code

hg-to-git: use git init instead of git init-db
[git.git] / builtin-mv.c
index 990e21355d189096bdc0c808fb536b7bfb85b0a1..5530e11b89c2c05c95c8ab1e82999eec0fdcc4c5 100644 (file)
@@ -81,7 +81,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
        struct path_list deleted = {NULL, 0, 0, 0};
        struct path_list changed = {NULL, 0, 0, 0};
 
-       git_config(git_default_config);
+       git_config(git_default_config, NULL);
 
        newfd = hold_locked_index(&lock_file, 1);
        if (read_cache() < 0)
@@ -164,7 +164,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                }
 
                                dst = add_slash(dst);
-                               dst_len = strlen(dst) - 1;
+                               dst_len = strlen(dst);
 
                                for (j = 0; j < last - first; j++) {
                                        const char *path =
@@ -172,7 +172,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                        source[argc + j] = path;
                                        destination[argc + j] =
                                                prefix_path(dst, dst_len,
-                                                       path + length);
+                                                       path + length + 1);
                                        modes[argc + j] = INDEX;
                                }
                                argc += last - first;
@@ -256,7 +256,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
                for (i = 0; i < added.nr; i++) {
                        const char *path = added.items[i].path;
-                       add_file_to_cache(path, verbose);
+                       if (add_file_to_cache(path, verbose ? ADD_CACHE_VERBOSE : 0))
+                               die("updating index entries failed");
                }
 
                for (i = 0; i < deleted.nr; i++)