chiark / gitweb /
git-debrebase: Fix a message to use "" properly
[dgit.git] / git-debrebase
index 59b15aa38045ef8a79e7bc2b9cfd5ef0093b64b7..e3fea7c84a1d2824c23fd933fdb2a7c3ab1e9ebe 100755 (executable)
@@ -396,6 +396,15 @@ sub classify ($) {
        # BreakwaterStart commits are also anchors in the terminology
        # of git-debrebase(5), but they are untagged (and always
        # manually generated).
+       #
+       # We cannot not tolerate any tagged linear commit (ie,
+       # BreakwaterStart commits tagged `[anchor:') because such a
+       # thing could result from an erroneous linearising raw git
+       # rebase of a merge anchor.  That would represent a corruption
+       # of the branch. and we want to detect and reject the results
+       # of such corruption before it makes it out anywhere.  If we
+       # reject it here then we avoid making the pseudomerge which
+       # would be needed to push it.
 
        my $badanchor = sub { $unknown->("git-debrebase \`anchor' but @_"); };
        @p == 2 or return $badanchor->("has other than two parents");
@@ -551,7 +560,7 @@ sub keycommits ($;$$$) {
            $breakwater = undef;
        } elsif ($ty eq 'Mixed') {
            $x->($unclean, 'mixed',
-                'found mixed upstream/packaging commit ($head)');
+                "found mixed upstream/packaging commit ($head)");
            $clogonly = undef;
            $breakwater = undef;
        } elsif ($ty eq 'Pseudomerge' or
@@ -1074,8 +1083,8 @@ sub stitch ($$$$$) {
     update_head $old_head, $new_head, "stitch: $prose";
 }
 
-sub do_stitch ($) {
-    my ($prose) = @_;
+sub do_stitch ($;$) {
+    my ($prose, $unclean) = @_;
 
     my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info();
     if (!$ffq_prev_commitish) {
@@ -1084,7 +1093,7 @@ sub do_stitch ($) {
     }
     my $dangling_head = get_head();
 
-    keycommits $dangling_head, \&snag, \&snag, \&snag;
+    keycommits $dangling_head, $unclean,$unclean,$unclean;
 
     stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose);
 }
@@ -1234,6 +1243,10 @@ sub cmd_new_upstream_v0 () {
  "[git-debrebase anchor: new upstream $new_upstream_version, merge]",
             ];
 
+       my $clogsignoff = cmdoutput qw(git show),
+           '--pretty=format:%an <%ae>  %aD',
+           $new_bw;
+
        # Now we have to add a changelog stanza so the Debian version
        # is right.
        die if unlink "debian";
@@ -1250,7 +1263,7 @@ $p ($new_version) UNRELEASED; urgency=medium
 
   * Update to new upstream version $new_upstream_version.
 
- -- 
+ -- $clogsignoff
 
 END
        close CN or die $!;
@@ -1303,13 +1316,27 @@ sub cmd_stitch () {
     my $prose = 'stitch';
     GetOptions('prose=s', \$prose) or die badusage("bad options to stitch");
     badusage "no arguments allowed" if @ARGV;
-    do_stitch($prose);
+    do_stitch $prose, 0;
+}
+sub cmd_prepush () { cmd_stitch(); }
+
+sub cmd_quick () {
+    badusage "no arguments allowed" if @ARGV;
+    do_launder_head 'launder for git-debrebase quick';
+    do_stitch 'quick', \&snag;
 }
 
 sub cmd_conclude () {
+    my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info();
+    if (!$ffq_prev_commitish) {
+       fail "No ongoing git-debrebase session." unless $opt_noop_ok;
+       return;
+    }
+    my $dangling_head = get_head();
+    
     badusage "no arguments allowed" if @ARGV;
-    do_launder_head 'launder for conclude';
-    do_stitch 'conclude';
+    do_launder_head 'launder for git-debrebase quick';
+    do_stitch 'quick', \&snag;
 }
 
 sub cmd_convert_from_gbp () {