Merge branch 'nd/multiple-work-trees'
[gitweb.git] / builtin / mv.c
index e2535505511678d8cda0a60930983753da79cc83..d1d43168ae79d0157f8adf9dc36a4d2683afe91b 100644 (file)
@@ -3,8 +3,8 @@
  *
  * Copyright (C) 2006 Johannes Schindelin
  */
-#include "cache.h"
 #include "builtin.h"
+#include "lockfile.h"
 #include "dir.h"
 #include "cache-tree.h"
 #include "string-list.h"
@@ -12,7 +12,7 @@
 #include "submodule.h"
 
 static const char * const builtin_mv_usage[] = {
-       N_("git mv [options] <source>... <destination>"),
+       N_("git mv [<options>] <source>... <destination>"),
        NULL
 };
 
@@ -184,10 +184,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
                                modes[i] = WORKING_DIRECTORY;
                                n = argc + last - first;
-                               source = xrealloc(source, n * sizeof(char *));
-                               destination = xrealloc(destination, n * sizeof(char *));
-                               modes = xrealloc(modes, n * sizeof(enum update_mode));
-                               submodule_gitfile = xrealloc(submodule_gitfile, n * sizeof(char *));
+                               REALLOC_ARRAY(source, n);
+                               REALLOC_ARRAY(destination, n);
+                               REALLOC_ARRAY(modes, n);
+                               REALLOC_ARRAY(submodule_gitfile, n);
 
                                dst = add_slash(dst);
                                dst_len = strlen(dst);
@@ -229,7 +229,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                if (!bad)
                        continue;
                if (!ignore_errors)
-                       die (_("%s, source=%s, destination=%s"),
+                       die(_("%s, source=%s, destination=%s"),
                             bad, src, dst);
                if (--argc > 0) {
                        int n = argc - i;
@@ -253,7 +253,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                        printf(_("Renaming %s to %s\n"), src, dst);
                if (!show_only && mode != INDEX) {
                        if (rename(src, dst) < 0 && !ignore_errors)
-                               die_errno (_("renaming '%s' failed"), src);
+                               die_errno(_("renaming '%s' failed"), src);
                        if (submodule_gitfile[i]) {
                                if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
                                        connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);