X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=git-debrebase;h=ab1990aff7be6c721d2e8629083fbcb994ee3b23;hp=599fe150d12cdbae0038183976cc1f4f594b1b62;hb=def888415f7c15890ac55019b3187b5931c0682e;hpb=e221ca98a0eb6ad2601f58002e0abdb0ea4f7374 diff --git a/git-debrebase b/git-debrebase index 599fe150..ab1990af 100755 --- a/git-debrebase +++ b/git-debrebase @@ -37,7 +37,8 @@ our $us = qw(git-debrebase); sub badusage ($) { my ($m) = @_; - die "bad usage: $m\n"; + print STDERR "bad usage: $m\n"; + exit 12; } sub cfg ($;$) { @@ -1071,6 +1072,21 @@ sub stitch ($$$$$) { update_head $old_head, $new_head, "stitch: $prose"; } +sub do_stitch ($) { + my ($prose) = @_; + + my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info(); + if (!$ffq_prev_commitish) { + fail "No ffq-prev to stitch." unless $opt_noop_ok; + return; + } + my $dangling_head = get_head(); + + keycommits $dangling_head, \&snag, \&snag, \&snag; + + stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose); +} + sub cmd_new_upstream_v0 () { # automatically and unconditionally launders before rebasing # if rebase --abort is used, laundering has still been done @@ -1285,17 +1301,7 @@ sub cmd_stitch () { my $prose = 'stitch'; GetOptions('prose=s', \$prose) or die badusage("bad options to stitch"); badusage "no arguments allowed" if @ARGV; - - my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info(); - if (!$ffq_prev_commitish) { - fail "No ffq-prev to stitch." unless $opt_noop_ok; - return; - } - my $old_head = get_head(); - - keycommits $old_head, \&snag, \&snag, \&snag; - - stitch($old_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose); + do_stitch($prose); } sub cmd_convert_from_gbp () {