# [BUG] rebase --onto doesn't abort properly

3 messages from 2014-01-06 to 2014-01-06. Participants: Ramkumar Ramachandra, Junio C Hamano.
Thread: https://gitlist.dev/t/35616

## Ramkumar Ramachandra, 2014-01-06 17:42

Subject: [BUG] rebase --onto doesn't abort properly
Message-ID: <CALkWK0mEN=LjWKKdWznCXk5YwRQXVDPwtxUvVJnrG9zPPvH-Rw@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0mEN%3DLjWKKdWznCXk5YwRQXVDPwtxUvVJnrG9zPPvH-Rw%40mail.gmail.com

```
Hi,

On the latest git, I noticed that a rebase --onto doesn't abort
properly. Steps to reproduce:

  # on some topic branch
  $ git rebase --onto master @~10
  ^C # quickly!
  $ git rebase --abort
  # HEAD is still detached

I tried going back a few revisions, and the bug seems to be very old;
I'm surprised I didn't notice it earlier.

Are others able to reproduce this?

Thanks.

Ram

```

## Junio C Hamano, 2014-01-06 18:44

Subject: Re: [BUG] rebase --onto doesn't abort properly
Message-ID: <xmqqha9hhrvz.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqha9hhrvz.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CALkWK0mEN=LjWKKdWznCXk5YwRQXVDPwtxUvVJnrG9zPPvH-Rw@mail.gmail.com>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:

> Hi,
>
> On the latest git, I noticed that a rebase --onto doesn't abort
> properly. Steps to reproduce:
>
>   # on some topic branch
>   $ git rebase --onto master @~10
>   ^C # quickly!
>   $ git rebase --abort
>   # HEAD is still detached

I do not think --abort was designed to abort an uncontrolled stop
like ^C in the first place.  To allow that kind of "recovery", you
need to teach "rebase" to first record the state you would want to
go back to before doing anything, but then what happens if the ^C
comes when you are still in the middle of doing so?

```

## Ramkumar Ramachandra, 2014-01-06 18:55

Subject: Re: [BUG] rebase --onto doesn't abort properly
Message-ID: <CALkWK0=a-jh_r0c-hYstyVAatfF4nwBk3uYQ6RX+0=8VsPasVQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0%3Da-jh_r0c-hYstyVAatfF4nwBk3uYQ6RX%2B0%3D8VsPasVQ%40mail.gmail.com
In-Reply-To: <xmqqha9hhrvz.fsf@gitster.dls.corp.google.com>

```
Junio C Hamano wrote:
> I do not think --abort was designed to abort an uncontrolled stop
> like ^C in the first place.

Why not? All it requires is a reset --hard to
.git/rebase-apply/head-name, as usual, no?

> To allow that kind of "recovery", you
> need to teach "rebase" to first record the state you would want to
> go back to before doing anything, but then what happens if the ^C
> comes when you are still in the middle of doing so?

I'm a bit puzzled: doesn't rebase write_basic_state() as soon as it
starts? It's true that we can't recover from a ^C before that, but I
would expect to be able to recover after a ^C somewhere in the middle.

```
