gitext-rs / git-stack

Stacked branch management for Git
Apache License 2.0
491 stars 19 forks source link

`git stack amend -e` eats commit message #307

Open Kinrany opened 1 year ago

Kinrany commented 1 year ago

Please complete the following tasks

Description

git stack amend -e fails to apply staged changes and to edit the commit message at the same time if the current branch has another branch stacked on top.

git-stack allows the user to write the message but then errors out with cannot reword; first squash dependent fixups. The staged changes get added as a new fixup! commit. The message is lost.

Version

git-stack 0.10.15

Steps to reproduce

  1. Create two commits, commit0 and commit1. commit1 is on top of commit0.
  2. Create two branches, branch0 on commit0 and branch1 on commit1.
  3. Switch to branch0.
  4. Make a change to the working tree and stage it.
  5. Run git stack amend -e.
  6. Write and save the commit message.

Actual Behaviour

Error happens after I've already typed the commit message. The message is irrecoverably lost. The staged changes end up in a new fixup! commit on top of branch0.

Expected Behaviour

git-stack performs the amend operation and changes the commit message.

Alternatively, git-stack warns that the operation cannot be performed before the user starts editing the commit message.

Alternatively, git-stack dumps the whole message into the console or into a temporary file.

Debug Output

No response

epage commented 1 year ago

Can you include a repo that reproduces this problem?

Before I start to reproducing this, I am looking to have a specific point clarified: whether this failure comes from there being conflicts or not.