@matheusbsbs / matheus-bagliano / commits / e421fc0797
Fork 0

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>

Eric Wong committed Apr 3, 2007 at 01:57 UTC e421fc0797d0a6c8a40bce96c4383223c8ae2da7
1 file changed +4 -1
git-svn.perl
+4 -1
@@ -33,7 +33,7 @@ use Carp qw/croak/;
33 use IO::File qw//;
34 use File::Basename qw/dirname basename/;
35 use File::Path qw/mkpath/;
36 -use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
36 +use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
37 use IPC::Open3;
38 use Git;
39
@@ -168,6 +168,7 @@ for (my $i = 0; $i < @ARGV; $i++) {
168 my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
169
170 read_repo_config(\%opts);
171 +Getopt::Long::Configure('pass_through') if $cmd eq 'log';
172 my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
173 'minimize-connections' => \$Git::SVN::Migration::_minimize,
174 'id|i=s' => \$Git::SVN::default_ref_id,
@@ -229,6 +230,8 @@ Usage: $0 <command> [options] [arguments]\n
230 next if /^multi-/; # don't show deprecated commands
231 print $fd ' ',pack('A17',$_),$cmd{$_}->[1],"\n";
232 foreach (keys %{$cmd{$_}->[2]}) {
233 + # mixed-case options are for .git/config only
234 + next if /[A-Z]/ && /^[a-z]+$/i;
235 # prints out arguments as they should be passed:
236 my $x = s#[:=]s$## ? '<arg>' : s#[:=]i$## ? '<num>' : '';
237 print $fd ' ' x 21, join(', ', map { length $_ > 1 ?