git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [Bug] Stashing during merge loses MERGING state
@ 2021-03-11 14:00 Tassilo Horn
  2021-03-11 19:25 ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Tassilo Horn @ 2021-03-11 14:00 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

I did a large merge, resolved the conflicts but still had compile
errors.  In order to check how stuff has worked before the merge, I
stashed all changes, and eventually popped the stash.  Then the MERGING
state was gone and committing created a single-parent commit rather than
a merge commit with two parents.  I was lucky to see that before
pushing, so all is good.

Here is a simple recipe with a publicly available repo:

```sh
git clone https://github.com/magit/magit.git
# Current master is 4735b9254105eb7dd538f979d8b4c6ab96b827b9
cd magit
git merge origin/km/reshelve-rewrite # currently 0073bff21c826a57a4b48076074bdbba092d4b67
# Conflict in magit-extras.el
git add lisp/magit-extras.el
git stash
# The MERGING state is gone
git stash pop
# And it won't come back, so when I commit now, my "merge" has just
# one parent.
```

What did you expect to happen? (Expected behavior)

I expected that stashing during a merge will keep the MERGING state.
Or that popping the stash again would also restore the MERGING state.

What happened instead? (Actual behavior)

The MERGING state is lost.

What's different between what you expected and what actually happened?

I've lost the MERGING state, thus committing results in a one-parent
commit rather than a 2-parent merge commit.

Anything else you want to add:

In my original situation, I've copied the working tree to /tmp, resetted
to origin/master, re-initiated the merge, copied the modified files from
the /tmp backup, staged the changes, committed, and pushed.

I wonder if there would have been a better approach to come from the
"accidentally having a single-parent commit containing all merged and
resolution changes" state to a proper merge commit state.  In the end,
the tree was correct, just the second parent to the commit on the merged
branch was missing.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.30.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.11.4-arch1-1 #1 SMP PREEMPT Sun, 07 Mar 2021 18:00:49 +0000 x86_64
compiler info: gnuc: 10.2
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /usr/bin/fish


[Enabled Hooks]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-12  7:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 14:00 [Bug] Stashing during merge loses MERGING state Tassilo Horn
2021-03-11 19:25 ` Jeff King
2021-03-11 20:31   ` Tassilo Horn
2021-03-12  5:00     ` Phil Hord
2021-03-12  6:09       ` Junio C Hamano
2021-03-12  7:04         ` Elijah Newren
2021-03-12  7:02       ` Chris Torek
2021-03-12  7:17         ` Elijah Newren
2021-03-12  7:02       ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).