]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/mv.c
Merge branch 'jc/mv-d-to-d-error-message-fix'
[thirdparty/git.git] / builtin / mv.c
index 80fc7a3c7029603a0fcaf9d15d8432ed799b4909..c596515ad0536f4b13ce2fdc2a797f6aaa9df70a 100644 (file)
@@ -7,10 +7,10 @@
 #include "builtin.h"
 #include "abspath.h"
 #include "advice.h"
-#include "alloc.h"
 #include "config.h"
 #include "environment.h"
 #include "gettext.h"
+#include "name-hash.h"
 #include "object-file.h"
 #include "pathspec.h"
 #include "lockfile.h"
@@ -18,6 +18,7 @@
 #include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
+#include "read-cache-ll.h"
 #include "repository.h"
 #include "setup.h"
 #include "submodule.h"
@@ -183,7 +184,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
        int src_dir_nr = 0, src_dir_alloc = 0;
        struct strbuf a_src_dir = STRBUF_INIT;
        enum update_mode *modes, dst_mode = 0;
-       struct stat st;
+       struct stat st, dest_st;
        struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
        struct lock_file lock_file = LOCK_INIT;
        struct cache_entry *ce;
@@ -303,7 +304,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                        goto act_on_entry;
                }
                if (S_ISDIR(st.st_mode)
-                   && lstat(dst, &st) == 0) {
+                   && lstat(dst, &dest_st) == 0) {
                        bad = _("destination already exists");
                        goto act_on_entry;
                }