chiark / gitweb /
git-debrebase: break out do_stitch (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Apr 2018 15:12:13 +0000 (16:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 15:07:01 +0000 (16:07 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 7a49dd7..ab1990a 100755 (executable)
@@ -1072,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
@@ -1286,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 () {