filter-branch: use $SHELL_PATH instead of 'sh'
[gitweb.git] / builtin-mv.c
index a3f9ad174492827e42f2854287fab19915d8ef76..94f6dd2aad2da512bab0be2e84859eced6553cc9 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;
@@ -264,7 +264,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
                if (active_cache_changed) {
                        if (write_cache(newfd, active_cache, active_nr) ||
-                           close(newfd) ||
                            commit_locked_index(&lock_file))
                                die("Unable to write new index file");
                }