Skip to content

Commit 512b620

Browse files
Eric WongJunio C Hamano
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 732bcf9 commit 512b620

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git-svn.perl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
use IO::File qw//;
3434
use File::Basename qw/dirname basename/;
3535
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/;
3737
use IPC::Open3;
3838
use Git;
3939

@@ -168,6 +168,7 @@ BEGIN
168168
my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
169169

170170
read_repo_config(\%opts);
171+
Getopt::Long::Configure('pass_through') if $cmd eq 'log';
171172
my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
172173
'minimize-connections' => \$Git::SVN::Migration::_minimize,
173174
'id|i=s' => \$Git::SVN::default_ref_id,
@@ -229,6 +230,8 @@ sub usage {
229230
next if /^multi-/; # don't show deprecated commands
230231
print $fd ' ',pack('A17',$_),$cmd{$_}->[1],"\n";
231232
foreach (keys %{$cmd{$_}->[2]}) {
233+
# mixed-case options are for .git/config only
234+
next if /[A-Z]/ && /^[a-z]+$/i;
232235
# prints out arguments as they should be passed:
233236
my $x = s#[:=]s$## ? '<arg>' : s#[:=]i$## ? '<num>' : '';
234237
print $fd ' ' x 21, join(', ', map { length $_ > 1 ?

0 commit comments

Comments
 (0)