{"thread":{"id":"7500","subject":"[PATCH] git-svn: bail out on incorrect command-line options","startedAt":"2007-04-03T08:57:08Z","lastAt":"2007-04-03T08:57:08Z","messageCount":1,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38499","messageId":"20070403085708.GA16051@muzzle","threadId":"7500","inReplyTo":null,"subject":"[PATCH] git-svn: bail out on incorrect command-line options","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-04-03T08:57:08Z","receivedAt":"2007-04-03T08:57:08Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"git svn log\" is the only command that needs the pass-through\noption in Getopt::Long; otherwise we will bail out and let the\nuser know something is wrong.\n\nAlso, avoid printing out unaccepted mixed-case options (that\nare reserved for the command-line) such as --useSvmProps\nin the usage() function.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n Sam: Cc-ing you because I saw you using use --useSvmProps in\n a tutorial you wrote, however this was disabled in:\n 97ae091169b233ecd80eb5ef2da80145f8c724f7\n and only enabled in lower-case form for the \"init\" and \"clone\"\n commands in:\n 0dfaf0a4e1905a9137d3f2f691620529aeb3b4fa\n\n git-svn.perl |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d307d43..6216cad 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -33,7 +33,7 @@ use Carp qw/croak/;\n use IO::File qw//;\n use File::Basename qw/dirname basename/;\n use File::Path qw/mkpath/;\n-use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;\n+use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;\n use IPC::Open3;\n use Git;\n \n@@ -168,6 +168,7 @@ for (my $i = 0; $i < @ARGV; $i++) {\n my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n \n read_repo_config(\\%opts);\n+Getopt::Long::Configure('pass_through') if $cmd eq 'log';\n my $rv = GetOptions(%opts, 'help|H|h' => \\$_help, 'version|V' => \\$_version,\n                     'minimize-connections' => \\$Git::SVN::Migration::_minimize,\n                     'id|i=s' => \\$Git::SVN::default_ref_id,\n@@ -229,6 +230,8 @@ Usage: $0 <command> [options] [arguments]\\n\n \t\tnext if /^multi-/; # don't show deprecated commands\n \t\tprint $fd '  ',pack('A17',$_),$cmd{$_}->[1],\"\\n\";\n \t\tforeach (keys %{$cmd{$_}->[2]}) {\n+\t\t\t# mixed-case options are for .git/config only\n+\t\t\tnext if /[A-Z]/ && /^[a-z]+$/i;\n \t\t\t# prints out arguments as they should be passed:\n \t\t\tmy $x = s#[:=]s$## ? '<arg>' : s#[:=]i$## ? '<num>' : '';\n \t\t\tprint $fd ' ' x 21, join(', ', map { length $_ > 1 ?\n-- \nEric Wong\n"}]}