chiark / gitweb /
git-debrebase: scrap: Make it honour --noop-ok
[dgit.git] / git-debrebase
index 98e645a43a9255b81a7821a671b406239c922f90..4046425e5fa92ffd66235a68e7833279af97370f 100755 (executable)
@@ -1577,6 +1577,21 @@ sub cmd_conclude () {
     do_stitch 'quick';
 }
 
+sub cmd_scrap () {
+    my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info();
+    if (!$ffq_prev_commitish) {
+       fail "No ongoing git-debrebase session." unless $opt_noop_ok;
+       finish 0;
+    }
+    my $scrapping_head = get_head();
+    badusage "no arguments allowed" if @ARGV;
+    push @deferred_updates,
+       "update $gdrlast $ffq_prev_commitish $git_null_obj",
+       "update $ffq_prev $git_null_obj $ffq_prev_commitish";
+    snags_maybe_bail();
+    update_head_checkout $scrapping_head, $ffq_prev_commitish, "scrap";
+}
+
 sub make_patches_staged ($) {
     my ($head) = @_;
     # Produces the patches that would result from $head if it were