Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-mv.c8
-rwxr-xr-xt/t7001-mv.sh2
2 files changed, 5 insertions, 5 deletions
diff --git a/builtin-mv.c b/builtin-mv.c
index bce9959293..01270fefdf 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
}
argc += last - first;
}
- } else if (lstat(dst, &st) == 0) {
+ } else if (cache_name_pos(src, length) < 0)
+ bad = "not under version control";
+ else if (lstat(dst, &st) == 0) {
bad = "destination exists";
if (force) {
/*
@@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
} else
bad = "Cannot overwrite";
}
- } else if (cache_name_pos(src, length) < 0)
- bad = "not under version control";
- else if (string_list_has_string(&src_for_dst, dst))
+ } else if (string_list_has_string(&src_for_dst, dst))
bad = "multiple sources for the same target";
else
string_list_insert(dst, &src_for_dst);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index ef7e56ed63..d2ec550af6 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -58,7 +58,7 @@ test_expect_success \
test ! -f path0/untracked1 &&
test ! -f path0/untracked2'
-test_expect_failure \
+test_expect_success \
'checking -f on untracked file with existing target' \
'touch path0/untracked1 &&
git mv -f untracked1 path0