chiark / gitweb /
Dgit.pm: gdr_ffq_prev_branchinfo: move from git-debrebase
[dgit.git] / git-debrebase
index 3cab3ad8837b4a28a4bc51be3bcad29d123ebd20..fd67629492dd08a220a4ebf29e426e869d108b29 100755 (executable)
@@ -973,19 +973,8 @@ sub cmd_analyse () {
 }
 
 sub ffq_prev_branchinfo () {
-    # => ('status', "message", [$current, $ffq_prev, $gdrlast])
-    # 'status' may be
-    #    branch         message is undef
-    #    weird-symref   } no $current,
-    #    notbranch      }  no $ffq_prev
     my $current = git_get_symref();
-    return ('detached', 'detached HEAD') unless defined $current;
-    return ('weird-symref', 'HEAD symref is not to refs/')
-       unless $current =~ m{^refs/};
-    my $ffq_prev = "refs/$ffq_refprefix/$'";
-    my $gdrlast = "refs/$gdrlast_refprefix/$'";
-    printdebug "ffq_prev_branchinfo branch current $current\n";
-    return ('branch', undef, $current, $ffq_prev, $gdrlast);
+    return gdr_ffq_prev_branchinfo($current);
 }
 
 sub record_ffq_prev_deferred () {
@@ -1505,6 +1494,9 @@ sub make_patches ($) {
 }
 
 sub cmd_make_patches () {
+    my $opt_quiet_would_amend;
+    GetOptions('quiet-would-amend!', \$opt_quiet_would_amend)
+       or die badusage("bad options to make-patches");
     badusage "no arguments allowed" if @ARGV;
     my $old_head = get_head();
     my $new = make_patches $old_head;
@@ -1516,9 +1508,12 @@ sub cmd_make_patches () {
        snags_maybe_bail();
        update_head_checkout $old_head, $new, 'make-patches';
     } else {
-       fail "Patch export produced patch amendments".
+       print STDERR failmsg
+           "Patch export produced patch amendments".
            " (abandoned output commit $new).".
-           "  Try laundering first.";
+           "  Try laundering first."
+           unless $opt_quiet_would_amend;
+       finish 7;
     }
 }