pull --rebase: exit early when the working directory is dirty
[gitweb.git] / builtin-mv.c
index 990e21355d189096bdc0c808fb536b7bfb85b0a1..fb8ffb41aaba5f6e2a8cc13207a2f2c407d6c91d 100644 (file)
@@ -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))
+                               die("updating index entries failed");
                }
 
                for (i = 0; i < deleted.nr; i++)