git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Chris Torek <chris.torek@gmail.com>
Cc: Phil Hord <phil.hord@gmail.com>, Tassilo Horn <tsdh@gnu.org>,
	Jeff King <peff@peff.net>, Git <git@vger.kernel.org>
Subject: Re: [Bug] Stashing during merge loses MERGING state
Date: Thu, 11 Mar 2021 23:17:04 -0800	[thread overview]
Message-ID: <CABPp-BG=EupfdjZXs5JZu4RPUyv61Rkxf0MQpR2xpGoYk2w6jQ@mail.gmail.com> (raw)
In-Reply-To: <CAPx1GvfguSyXznaaeQYB8JY96vmZmzOJyTnXX1yP3omeXptqXw@mail.gmail.com>

On Thu, Mar 11, 2021 at 11:07 PM Chris Torek <chris.torek@gmail.com> wrote:
>
> On Thu, Mar 11, 2021 at 9:19 PM Phil Hord <phil.hord@gmail.com> wrote:
> > I wonder if a fix could be as simple as recording the MERGE_HEAD as
> > the third parent commit of the stash ref.
>
> There is already a third parent, but only when using -u / -a: this
> third-parent commit holds the untracked files (which are then removed
> a la `git clean`).
>
> A better trick would, I think, be able to save a partial merge state
> in general, including the unmerged statuses of various files, the
> ongoing action (merge or one of the other things that use it), and
> so on, in a form that could be restored later.  A plain `git stash` in
> any partially-merged state should tell you: no, use the fancier
> merge-state-saver instead.
>
> > I think being able to stash during a merge conflict could be very
> > useful.  I do sometimes need to get back to a working state
> > momentarily and a merge conflict represents a long pole to doing so.
> > Similarly, it could be useful to stash a conflicted `git rebase` so I
> > could return to it later and pick up where I left off.  Now we really
> > would need to store some extra metadata, though, like the todo-list
> > and ORIG_HEAD.  And we would definitely need some extra command line
> > switch to tell stash (or rebase) that I want to include all the rebase
> > state and also "pause" the rebase by restoring to my starting point.
>
> This is the sort of thing I'm thinking of, for the "superstash" (terrible
> name for it). Note that whatever this becomes, it should be send-able
> (via push and/or email) so that you can have multiple people work
> on resolving a particularly hairy merge.

You can use git-imerge (https://github.com/mhagger/git-imerge) for
that...just not once you've already started a merge (unless you're
willing to undo and restart).

As per my other email, I'm pretty worried about attempting to stash a
merge, given that stash allows its contents to be "reapplied" on top
of a different commit.  That works fine for single-parent commits, but
merges have multiple parents and it'd be rather tricky to reapply such
a stash on a different base without creating an evil merge.  Perhaps
if "superstash" forced you to only reapply on the same base then it'd
be fine...but it's starting to no longer be a "stash" anymore but
something else.

  reply	other threads:[~2021-03-12  7:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-03-12  7:02       ` Elijah Newren

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CABPp-BG=EupfdjZXs5JZu4RPUyv61Rkxf0MQpR2xpGoYk2w6jQ@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=chris.torek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=phil.hord@gmail.com \
    --cc=tsdh@gnu.org \
    /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.
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).