chiark / gitweb /
git-debrebase: new-upstream: Do not treat late options as version
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 Feb 2020 10:38:31 +0000 (10:38 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 22 Jun 2020 18:04:08 +0000 (19:04 +0100)
Instead of a new upstream version, the user may wish to pass -i.
(Or other git-rebase options.)

This is handled correctly when we are deciding whether to treat
further arguments as additional piece specifications, but the new
optional upstream version commitish was mishandled in this respect.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 8f36d9dcf4ccfc5a5fc16295f89e9b8ab643bd59..781435861ecb05b1c816a440364425746abae6f7 100755 (executable)
@@ -1973,7 +1973,7 @@ sub cmd_new_upstream () {
        $new_version = (new Dpkg::Version "$spec_version-1", check => 1);
     }
 
-    my $new_upstream = shift @ARGV;
+    my $new_upstream = (@ARGV && $ARGV[0] !~ m{^-}) ? shift @ARGV : undef;
     my $new_upstream_version = upstreamversion  $new_version;
     my $new_upstream_used;
     ($new_upstream, $new_upstream_used) =