summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-12-12 07:51:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-12-12 19:55:46 (GMT)
commit77471646d3d87691b4bcf11682945e6ccc27f9e3 (patch)
tree8d057241e1c4f0fd8e398d7084722f7e096ad588
parent07b8738967a26dd7ab39d02b86aa805dea567319 (diff)
downloadgit-77471646d3d87691b4bcf11682945e6ccc27f9e3.zip
git-77471646d3d87691b4bcf11682945e6ccc27f9e3.tar.gz
git-77471646d3d87691b4bcf11682945e6ccc27f9e3.tar.bz2
mv: make non-directory destination error more clear
If you try to "git mv" multiple files onto another non-directory file, you confusingly get the "usage" message: $ touch one two three $ git add . $ git mv one two three usage: git mv [options] <source>... <destination> [...] From the user's perspective, that makes no sense. They just gave parameters that exactly match that usage! This behavior dates back to the original C version of "git mv", which had a usage message like: usage: git mv (<source> <destination> | <source>... <destination>) This was slightly less confusing, because it at least mentions that there are two ways to invoke (but it still isn't clear why what the user provided doesn't work). Instead, let's show an error message like: $ git mv one two three fatal: destination 'three' is not a directory We could leave the usage message in place, too, but it doesn't actually help here. It contains no hints that there are two forms, nor that multi-file form requires that the endpoint be a directory. So it just becomes useless noise that distracts from the real error. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/mv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index 449f30a..177e543 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -90,7 +90,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
destination = copy_pathspec(dest_path[0], argv, argc, 1);
} else {
if (argc != 1)
- usage_with_options(builtin_mv_usage, builtin_mv_options);
+ die("destination '%s' is not a directory", dest_path[0]);
destination = dest_path;
}