chiark / gitweb /
git-debrebase: introduce ffq_prev_info (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 5 Apr 2018 19:20:30 +0000 (20:20 +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 866b0de..00e5588 100755 (executable)
@@ -1032,6 +1032,18 @@ sub record_ffq_auto () {
     }
 }
 
+sub ffq_prev_info () {
+    # => ($ffq_prev, $gdrlast, $ffq_prev_commitish)
+    my ($status, $message, $current, $ffq_prev, $gdrlast)
+       = ffq_prev_branchinfo();
+    if ($status ne 'branch') {
+       fproblem $status, "could not check ffq-prev: $message";
+       fproblems_maybe_bail();
+    }
+    my $ffq_prev_commitish = $ffq_prev && git_get_ref $ffq_prev;
+    return ($ffq_prev, $gdrlast, $ffq_prev_commitish);
+}
+
 sub stitch ($$$$$) {
     my ($old_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose) = @_;
 
@@ -1273,13 +1285,8 @@ sub cmd_stitch () {
     my $prose = '';
     GetOptions('prose=s', \$prose) or die badusage("bad options to stitch");
     badusage "no arguments allowed" if @ARGV;
-    my ($status, $message, $current, $ffq_prev, $gdrlast)
-       = ffq_prev_branchinfo();
-    if ($status ne 'branch') {
-       fproblem $status, "could not check ffq-prev: $message";
-       fproblems_maybe_bail();
-    }
-    my $ffq_prev_commitish = $ffq_prev && git_get_ref $ffq_prev;
+
+    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;