aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-04-03 01:57:08 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-04 02:37:35 -0700
commite421fc0797d0a6c8a40bce96c4383223c8ae2da7 (patch)
tree0304020f62eabb7bf5f9db32d07d7c62e37af2d1
parent3be8e720d95f8d040dbfdd8a579616a9423280df (diff)
downloadgit-e421fc0797d0a6c8a40bce96c4383223c8ae2da7.tar.gz
git-e421fc0797d0a6c8a40bce96c4383223c8ae2da7.tar.xz
git-svn: bail out on incorrect command-line options
"git svn log" is the only command that needs the pass-through option in Getopt::Long; otherwise we will bail out and let the user know something is wrong. Also, avoid printing out unaccepted mixed-case options (that are reserved for the command-line) such as --useSvmProps in the usage() function. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgit-svn.perl5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-svn.perl b/git-svn.perl
index d307d430f..6216cade0 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -33,7 +33,7 @@ use Carp qw/croak/;
use IO::File qw//;
use File::Basename qw/dirname basename/;
use File::Path qw/mkpath/;
-use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
+use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
use IPC::Open3;
use Git;
@@ -168,6 +168,7 @@ for (my $i = 0; $i < @ARGV; $i++) {
my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
read_repo_config(\%opts);
+Getopt::Long::Configure('pass_through') if $cmd eq 'log';
my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
'minimize-connections' => \$Git::SVN::Migration::_minimize,
'id|i=s' => \$Git::SVN::default_ref_id,
@@ -229,6 +230,8 @@ Usage: $0 <command> [options] [arguments]\n
next if /^multi-/; # don't show deprecated commands
print $fd ' ',pack('A17',$_),$cmd{$_}->[1],"\n";
foreach (keys %{$cmd{$_}->[2]}) {
+ # mixed-case options are for .git/config only
+ next if /[A-Z]/ && /^[a-z]+$/i;
# prints out arguments as they should be passed:
my $x = s#[:=]s$## ? '<arg>' : s#[:=]i$## ? '<num>' : '';
print $fd ' ' x 21, join(', ', map { length $_ > 1 ?