chiark / gitweb /
git-debrebase: ffq_check: Move defaults for $ff and $notff into sub
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jul 2018 18:40:35 +0000 (19:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jul 2018 23:15:21 +0000 (00:15 +0100)
No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index b029e5cff9d1789673d4be8cbb359b85da1043dc..a79b4867b63def9888baadee4be3cc8563d51655 100755 (executable)
@@ -980,7 +980,7 @@ sub ffq_prev_branchinfo () {
     return gdr_ffq_prev_branchinfo($current);
 }
 
     return gdr_ffq_prev_branchinfo($current);
 }
 
-sub ffq_check ($$$) {
+sub ffq_check ($;$$) {
     # calls $ff and/or $notff zero or more times
     # then returns either (status,message) where status is
     #    exists
     # calls $ff and/or $notff zero or more times
     # then returns either (status,message) where status is
     #    exists
@@ -994,6 +994,9 @@ sub ffq_check ($$$) {
     # normally $currentval should be HEAD
     my ($currentval, $ff, $notff) =@_;
 
     # normally $currentval should be HEAD
     my ($currentval, $ff, $notff) =@_;
 
+    $ff //= sub { print $_[0] or die $!; };
+    $notff //= \&snag;
+
     my ($status, $message, $current, $ffq_prev, $gdrlast)
        = ffq_prev_branchinfo();
     return ($status, $message) unless $status eq 'branch';
     my ($status, $message, $current, $ffq_prev, $gdrlast)
        = ffq_prev_branchinfo();
     return ($status, $message) unless $status eq 'branch';
@@ -1073,8 +1076,7 @@ sub record_ffq_prev_deferred () {
     #   some messages about ff checks
     my $currentval = get_head();
 
     #   some messages about ff checks
     my $currentval = get_head();
 
-    my ($status,$message, $ffq_prev,$gdrlast) =
-       ffq_check $currentval, sub { print $_[0] or die $!; }, \&snag;
+    my ($status,$message, $ffq_prev,$gdrlast) = ffq_check $currentval;
     return ($status,$message) if defined $status;
 
     snags_maybe_bail();
     return ($status,$message) if defined $status;
 
     snags_maybe_bail();