chiark / gitweb /
git-debrebase: convert-from-*: leave debrebase-last refs
[dgit.git] / git-debrebase
index 059d02b546e8b33020ca7bdb48cacd7972d6e660..9d0bda0b41b4cc6ccce0c1f6bd87144bb36dd77d 100755 (executable)
@@ -2416,12 +2416,19 @@ sub begin_convert_from () {
 
     fail "ffq-prev exists, this is already managed by git-debrebase!"
        if $ffq_prev && git_get_ref $ffq_prev;
-    return ($head, undef);
+
+    my $gdrlast_obj = $gdrlast && git_get_ref $gdrlast;
+    snag 'already-converted',
+       "ahead of debrebase-last, this is already managed by git-debrebase!"
+       if $gdrlast_obj && is_fast_fwd $gdrlast_obj, $head;
+    return ($head, { LastRef => $gdrlast, LastObj => $gdrlast_obj });
 }
 
 sub complete_convert_from ($$$$) {
     my ($old_head, $new_head, $gi, $mrest) = @_;
     ffq_check $new_head;
+    record_gdrlast $gi->{LastRef}, $new_head, $gi->{LastObj}
+       if $gi->{LastRef};
     snags_maybe_bail();
     update_head_checkout $old_head, $new_head, $mrest;
 }