chiark / gitweb /
git-debrebase: convert-to-gbp: Handle no-patches case better
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 12:33:16 +0000 (13:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 12:34:17 +0000 (13:34 +0100)
In this case it's very like git-debrebase forget-was-debrebase.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 353b405..a67008f 100755 (executable)
@@ -2635,13 +2635,18 @@ sub cmd_convert_to_gbp () {
     my (undef, undef, undef, $ffq, $gdrlast) = ffq_prev_branchinfo();
     my ($anchor, $breakwater) = keycommits $head, 0;
     my $out = $breakwater;
-    make_patches_staged $head;
-    in_workarea sub {
-       $out = make_commit [$out], [
-            'Commit patch queue (converted from git-debrebase format)',
-            '[git-debrebase convert-to-gbp: commit patches]',
-        ];
-    };
+    my $any = make_patches_staged $head;
+    if ($any) {
+       in_workarea sub {
+           $out = make_commit [$out], [
+               'Commit patch queue (converted from git-debrebase format)',
+               '[git-debrebase convert-to-gbp: commit patches]',
+           ];
+       };
+    } else {
+       # in this case, it can be fast forward
+       $out = $head;
+    }
     if (defined $ffq) {
        push @deferred_updates, "delete $ffq";
        push @deferred_updates, "delete $gdrlast";