summaryrefslogtreecommitdiff
path: root/builtin-mv.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-02-04 13:07:09 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-02-04 13:07:09 -0800
commitde8139005f04a4a5ad8a54c771475803594028cd (patch)
treeb8ca6c2c2c591bdd8d99ffe62797e80ff8ff8008 /builtin-mv.c
parentMerge branch 'wp/add-patch-find' (diff)
parenturls.txt: document optional port specification in git URLS (diff)
downloadtgif-de8139005f04a4a5ad8a54c771475803594028cd.tar.xz
Merge branch 'maint'
* maint: urls.txt: document optional port specification in git URLS builtin-mv.c: check for unversionned files before looking at the destination. Add a testcase for "git mv -f" on untracked files. Missing && in t/t7001.sh.
Diffstat (limited to 'builtin-mv.c')
-rw-r--r--builtin-mv.c8
1 files changed, 4 insertions, 4 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);