From f3fdd7c966b98d28b3e1f6918e92364ed8c9a7e2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 21 Jul 2017 20:37:06 +0200 Subject: gpush: remove ability to specify arbitrary git push options this was once used to pass -n and -v to git, but we do that explicitly now. passing on unknown options just serves to obfuscate usage errors. Change-Id: I6d971e7c5ba8d3be7093f4171b4a7a03cf63ec90 Reviewed-by: Edward Welbourne --- bin/git-gpush | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/bin/git-gpush b/bin/git-gpush index 1a616c0..5220334 100755 --- a/bin/git-gpush +++ b/bin/git-gpush @@ -23,7 +23,7 @@ sub usage { print << "EOM"; Usage: - git gpush [opts] [[sha1/ref-from]:[ref-to]] [+] [=] [-- ] + git gpush [opts] [[sha1/ref-from]:[ref-to]] [+] [=] Pushes Changes to Gerrit and adds reviewers and CC to the PatchSets. @@ -39,12 +39,6 @@ Description: If no ref-to is specified, the upstream branch for 'ref-from' is used as the target branch. - If all the options above have been populated, the remainder - options are passed on directly to the normal 'git push' command. - If you want to avoid specifying all options first, any options - specified after a '--' are also passed on directly to the - underlying 'git push' command. - Note that this program can be used in the middle of an interactive rebase, to push out the amended commits instantly. @@ -119,10 +113,8 @@ my $quiet = 0; my $dry_run = 0; my $remote = "gerrit"; -my $remote_override = 0; my $ref_from = "HEAD"; my $ref_to = ""; -my $ref_override = 0; my $draft = 0; my %aliases; @@ -317,28 +309,21 @@ sub parse_arguments(@) } elsif ($arg eq "-?" || $arg eq "--?" || $arg eq "-h" || $arg eq "--help") { usage(); exit 0; - } elsif ($arg eq "--") { - push @arguments, @_; - return; } elsif ($arg =~ /^\+(.+)/) { push @reviewers, split(/,/, lookup_alias($1)); } elsif ($arg =~ /^\=(.+)/) { push @CCs, split(/,/, lookup_alias($1)); - } elsif ($arg =~ /^\-(.+)/) { - push @arguments, $arg; - } elsif (!$remote_override || !$ref_override) { + } elsif ($arg !~ /^\-/) { if ($arg =~ /(.*):(.*)/) { $ref_from = $1 if (defined $1 && $1 ne ""); $ref_to = $2 if (defined $2 && $2 ne ""); - $ref_override = 1; } else { print STDERR "Warning: Specifying a bare remote is deprecated.". " Use --remote instead.\n"; $remote = $arg; - $remote_override = 1; } } else { - push @arguments, $arg; + die("Unrecognized option '$arg'.\n"); } } -- cgit v1.2.3