{"thread":{"id":"3504","subject":"[PATCH] git-mv: Allow -h without repo & fix error message","startedAt":"2006-03-01T17:16:36Z","lastAt":"2006-03-01T17:16:36Z","messageCount":1,"participants":["Josef Weidendorfer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16958","messageId":"200603011816.36981.Josef.Weidendorfer@gmx.de","threadId":"3504","inReplyTo":null,"subject":"[PATCH] git-mv: Allow -h without repo & fix error message","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2006-03-01T17:16:36Z","receivedAt":"2006-03-01T17:16:36Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"This fixes \"git-mv -h\" to output the usage without the need\nto be in a git repository.\nAdditionally:\n- fix confusing error message when only one arg was given\n- fix typo in error message\n\nSigned-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n\n---\n\n git-mv.perl |   16 ++++++++++------\n 1 files changed, 10 insertions(+), 6 deletions(-)\n\n2f1dc137362cfa84553340a8f1310bc784e5935b\ndiff --git a/git-mv.perl b/git-mv.perl\nindex 2ea852c..8cd95c4 100755\n--- a/git-mv.perl\n+++ b/git-mv.perl\n@@ -19,15 +19,15 @@ EOT\n \texit(1);\n }\n \n-my $GIT_DIR = `git rev-parse --git-dir`;\n-exit 1 if $?; # rev-parse would have given \"not a git dir\" message.\n-chomp($GIT_DIR);\n-\n our ($opt_n, $opt_f, $opt_h, $opt_k, $opt_v);\n getopts(\"hnfkv\") || usage;\n usage() if $opt_h;\n @ARGV >= 1 or usage;\n \n+my $GIT_DIR = `git rev-parse --git-dir`;\n+exit 1 if $?; # rev-parse would have given \"not a git dir\" message.\n+chomp($GIT_DIR);\n+\n my (@srcArgs, @dstArgs, @srcs, @dsts);\n my ($src, $dst, $base, $dstDir);\n \n@@ -46,10 +46,14 @@ if (-d $ARGV[$argCount-1]) {\n \t}\n }\n else {\n-    if ($argCount != 2) {\n+    if ($argCount < 2) {\n+\tprint \"Error: need at least two arguments\\n\";\n+\texit(1);\n+    }\n+    if ($argCount > 2) {\n \tprint \"Error: moving to directory '\"\n \t    . $ARGV[$argCount-1]\n-\t    . \"' not possible; not exisiting\\n\";\n+\t    . \"' not possible; not existing\\n\";\n \texit(1);\n     }\n     @srcArgs = ($ARGV[0]);\n-- \n1.2.0.g719b\n"}]}