runcmd @git, qw(rm --quiet --ignore-unmatch -rf debian/patches);
}
+sub currently_rebasing() {
+ foreach (qw(rebase-merge rebase-apply)) {
+ return 1 if stat_exists "$maindir_gitdir/$_";
+ }
+ return 0;
+}
+
+sub bail_if_rebasing() {
+ fail "you are in the middle of a git-rebase already"
+ if currently_rebasing();
+}
+
sub do_launder_head ($) {
my ($reflogmsg) = @_;
my $old = get_head();
# if "deferred", will have added something about that to
# @deferred_update_messages, and also maybe printed (already)
# some messages about ff checks
+ bail_if_rebasing();
my $currentval = get_head();
my ($status,$message, $ffq_prev,$gdrlast) = ffq_check $currentval;
}
sub ffq_prev_info () {
+ bail_if_rebasing();
# => ($ffq_prev, $gdrlast, $ffq_prev_commitish)
my ($status, $message, $current, $ffq_prev, $gdrlast)
= ffq_prev_branchinfo();
print " not git-debrebase (diverged since last stitch)\n"
}
}
+ print "you are currently rebasing\n" if currently_rebasing();
}
sub cmd_stitch () {
sub cmd_scrap () {
my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info();
- fail "No ongoing git-debrebase session." unless $ffq_prev_commitish;
+ 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,
getoptions("make-patches",
'quiet-would-amend!', \$opt_quiet_would_amend);
badusage "no arguments allowed" if @ARGV;
+ bail_if_rebasing();
my $old_head = get_head();
my $new = make_patches $old_head;
my $d = get_differs $old_head, $new;