]> git.ipfire.org Git - thirdparty/git.git/commit
rebase: write script before initializing state
authorØystein Walle <oystwa@gmail.com>
Mon, 9 Jun 2025 22:10:55 +0000 (00:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jun 2025 22:56:57 +0000 (15:56 -0700)
commitade14bffd71b75974492cf7afc525b8feb8a70b2
treed2e64e41573a6ccb80e351b94d8b71c760a4eb1c
parentd50a5e8939abfc07c2ff97ae72e9330939b36ee0
rebase: write script before initializing state

If rebase.instructionFormat is invalid the repository is left in a
strange state when the interactive rebase fails. `git status` outputs
boths the same as it would in the normal case *and* something related to
interactive rebase:

    $ git -c rebase.instructionFormat=blah rebase -i
    fatal: invalid --pretty format: blah
    $ git status
    On branch master
    Your branch is ahead of 'upstream/master' by 1 commit.
      (use "git push" to publish your local commits)

    git-rebase-todo is missing.
    No commands done.
    No commands remaining.
    You are currently editing a commit while rebasing branch 'master' on '8db3019401'.
      (use "git commit --amend" to amend the current commit)
      (use "git rebase --continue" once you are satisfied with your changes)

By attempting to write the rebase script before initializing the state
this potential scenario is avoided.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
t/t3415-rebase-autosquash.sh