git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Brian Lyles <brianmlyles@gmail.com>, git@vger.kernel.org
Subject: Re: [BUG REPORT] `--autostash` rebase + pre-rebase error ends in corrupt state
Date: Tue, 13 Aug 2024 11:01:53 +0100	[thread overview]
Message-ID: <61ea41e7-d525-496b-aa2c-f605b99fc3d5@gmail.com> (raw)
In-Reply-To: <17ea26263cf57664.70b1dd9aae081c6e.203dcd72f6563036@zivdesk>

Hi Brian

On 09/08/2024 20:29, Brian Lyles wrote:
> If you perform a rebase using `--autostash`, and the pre-rebase hook
> exits with a non-zero exit code, your worktree is left in some sort of
> invalid state. This is reproducible with the following script:

Thanks for reporting this. It looks like the rebase code was written on 
the assumption that we only write the state files after successfully 
checking out the commit we're rebasing onto. Unfortunately "--autostash" 
breaks that assumption as it creates the autostash state file much 
earlier leading to an inconsistent state if the rebase cannot start. 
I'll post a fix later this week.

> You're able to recover from this by using `git rebase --quit` and then
> resetting to the commit you were on before attempting the rebase.

I don't think you should need to reset HEAD as it should be untouched. 
You can get the stashed changes back by running "git stash --apply" with 
the oid from the "Created autostash: ..." line that rebase prints.

Best Wishes

Phillip

      reply	other threads:[~2024-08-13 10:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09 19:29 [BUG REPORT] `--autostash` rebase + pre-rebase error ends in corrupt state Brian Lyles
2024-08-13 10:01 ` Phillip Wood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61ea41e7-d525-496b-aa2c-f605b99fc3d5@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=brianmlyles@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).