diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-04-22 16:38:51 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-06-16 16:07:01 +0100 |
commit | deb725236dab7d80249e72e871d069be25a607f8 (patch) | |
tree | fc40faf1d53ca3bf3af811e4135546cad5e816e4 | |
parent | f58777f379b8fea92d8ae4f80c1bba3299d951b3 (diff) |
git-debrebase: Handle -i option as a git-rebase option
Ie, as a request to do a rebase.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | git-debrebase | 18 | ||||
-rw-r--r-- | git-debrebase.1.pod | 9 |
2 files changed, 24 insertions, 3 deletions
diff --git a/git-debrebase b/git-debrebase index 72b4828..748b49b 100755 --- a/git-debrebase +++ b/git-debrebase @@ -32,6 +32,7 @@ use Dpkg::Version; use File::FnMatch qw(:fnmatch); our ($opt_force, $opt_noop_ok, @opt_anchors); +our ($opt_defaultcmd_interactive); our $us = qw(git-debrebase); @@ -906,6 +907,7 @@ sub cmd_launder_v0 () { } sub defaultcmd_rebase () { + push @ARGV, @{ $opt_defaultcmd_interactive // [] }; my ($tip,$breakwater) = do_launder_head 'launder for rebase'; runcmd @git, qw(rebase), @ARGV, $breakwater; } @@ -1461,7 +1463,19 @@ GetOptions("D+" => \$debuglevel, 'noop-ok', => \$opt_noop_ok, 'f=s' => \@snag_force_opts, 'anchor=s' => \@opt_anchors, - 'force!') or die badusage "bad options\n"; + 'force!', + '-i:s' => sub { + my ($opt,$val) = @_; + badusage "git-debrebase: no cuddling to -i for git-rebase" + if length $val; + die if $opt_defaultcmd_interactive; # should not happen + $opt_defaultcmd_interactive = [ qw(-i) ]; + # This access to @ARGV is excessive familiarity with + # Getopt::Long, but there isn't another sensible + # approach. '-i=s{0,}' does not work with bundling. + push @$opt_defaultcmd_interactive, @ARGV; + @ARGV=(); + }) or die badusage "bad options\n"; initdebug('git-debrebase '); enabledebug if $debuglevel; @@ -1472,7 +1486,7 @@ $rd = fresh_playground "$playprefix/misc"; @opt_anchors = map { git_rev_parse $_ } @opt_anchors; -if (!@ARGV || $ARGV[0] =~ m{^-}) { +if (!@ARGV || $opt_defaultcmd_interactive || $ARGV[0] =~ m{^-}) { defaultcmd_rebase(); } else { my $cmd = shift @ARGV; diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index 8f092c8..bdec02f 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -29,10 +29,13 @@ which defines many important terms used here. =item git-debrebase [-- <git-rebase options...>] +=item git-debrebase [-i <further git-rebase options...>] + Unstitches and launders the branch. (See L</UNSTITCHING AND LAUNDERING> below.) -Then optionally edits the Debian delta queue, +Then, if any git-rebase options were supplied, +edits the Debian delta queue, using git-rebase, by running git rebase <git-rebase options> <breakwater-tip> @@ -48,6 +51,10 @@ If you abort the git-rebase, the branch will still have been laundered, but everything in the rebase will be undone. +The options for git-rebase must either start with C<-i>, +or be prececded by C<-->, +to distinguish them from options for git-debrebase. + =item git-debrebase conclude Launder and restitch the branch, |