summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-11 21:59:53 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-12 01:41:46 +0100
commit97b08388e773fb6c89817f583ea75dd0098f988a (patch)
treea18b23e44ec571e4f967f5a1f20e4ec13e059aff
parentbab4f09f510a6af03210b40215bae6f1cf2c3179 (diff)
git-debrebase: scrap works properly when it does only rebase --abort
We use @deferred_updates to see if we actually did anything for --noop-ok purposes. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r--debian/changelog1
-rwxr-xr-xgit-debrebase23
2 files changed, 17 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index cfc7b5c..28b4811 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ dgit (6.7~) unstable; urgency=medium
* git-debrebase: Better (less copious by default) debug output.
* git-debrebase: Do not bail making patches if there aren't any.
* test suite: Set DEBFULLNAME
+ * git-debrebase: scrap works properly when it does only rebase --abort.
--
diff --git a/git-debrebase b/git-debrebase
index a4cafb6..09e0907 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -2204,19 +2204,28 @@ sub cmd_conclude () {
sub cmd_scrap () {
if (currently_rebasing()) {
runcmd @git, qw(rebase --abort);
+ push @deferred_updates, 'verify HEAD HEAD';
+ # noop, but stops us complaining that scrap was a noop
}
+ badusage "no arguments allowed" if @ARGV;
my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info();
- if (!$ffq_prev_commitish) {
+ my $scrapping_head;
+ if ($ffq_prev_commitish) {
+ $scrapping_head = get_head();
+ push @deferred_updates,
+ "update $gdrlast $ffq_prev_commitish $git_null_obj",
+ "update $ffq_prev $git_null_obj $ffq_prev_commitish";
+ }
+ if (!@deferred_updates) {
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";
+ if ($scrapping_head) {
+ update_head_checkout $scrapping_head, $ffq_prev_commitish, "scrap";
+ } else {
+ run_deferred_updates "scrap";
+ }
}
sub make_patches_staged ($) {