}
}
+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) = @_;
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;