All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Dmitry Gutov <dgutov@yandex.ru>, git@vger.kernel.org
Subject: Re: How do I resolve conflict after popping stash without adding the file to index?
Date: Wed, 22 Apr 2015 15:55:13 -0400	[thread overview]
Message-ID: <20150422195513.GC27656@peff.net> (raw)
In-Reply-To: <xmqq8udkdk1a.fsf@gitster.dls.corp.google.com>

On Wed, Apr 22, 2015 at 12:45:21PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > Ironically, the message before e0e2a9c actually recommends staging
> > changes before applying the stash, which would lead to this exact
> > situation!
> 
> The ancient history is hazy to me, but did we fall back to three-way
> merge in old days (or did anything to the index for that matter), I
> wonder?  In a world "git stash apply" only applied the change to the
> working tree via "git apply", that old recommendation would make
> perfect sense.

Hmm, that advice came in 2a79d2f (Clarify how the user can satisfy
stash's 'dirty state' check., 2008-09-29), at which point it looks like
we were already running merge-recursive. So I think it was simply bad
advice. ;)

> But obviously we do not live in such a world right now.  And because
> we are doing "merge-recursive", we should insist on a clean index;
> otherwise there is no way to "undo" its effect without losing the
> changes by the end-user.

Yeah, agreed.

> > but it makes me wonder if somebody would find it annoying that they
> > cannot apply a stash into their work-in-progress (i.e., it _might_ cause
> > annoyance, but most of the time it will be convenient to do so).
> 
> They can always do "git stash show -p stash@{n} | git apply" if they
> want to build changes incrementally X-<, but it would be annoying.

I think the best thing to do is introduce this safety, let it cook for a
while, and see what comes up. Perhaps we could add a "--force" or
similar, but I'd rather see if anybody ever actually runs into the
situation first.

> > So probably we'd want to refactor that into two separate functions, and
> > only call the require_clean_index part.
> 
> Hmph, but what would that helper do, other than a single "diff-index
> --quiet --cached HEAD" call?

I was wanting to keep the error message and the flags we feed to
diff-index consistent. But yeah, there is little enough duplicate
material and enough added boilerplate that I do not think it is worth it
(see the series I just posted).

-Peff

      reply	other threads:[~2015-04-22 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 21:02 How do I resolve conflict after popping stash without adding the file to index? Dmitry Gutov
2015-04-20 21:11 ` Junio C Hamano
2015-04-20 22:54   ` Dmitry Gutov
2015-04-21 21:29     ` Jeff King
2015-04-21 22:35       ` Dmitry Gutov
2015-04-21 22:52         ` Jeff King
2015-04-22 17:41           ` Junio C Hamano
2015-04-22 18:35             ` Jeff King
2015-04-22 19:29               ` Jeff King
2015-04-22 19:30                 ` [PATCH 1/3] t3903: stop hard-coding commit sha1s Jeff King
2015-04-22 19:30                 ` [PATCH 2/3] t3903: avoid applying onto dirty index Jeff King
2015-04-22 19:31                 ` [PATCH 3/3] stash: require a clean index to apply Jeff King
2015-04-22 19:45               ` How do I resolve conflict after popping stash without adding the file to index? Junio C Hamano
2015-04-22 19:55                 ` Jeff King [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=20150422195513.GC27656@peff.net \
    --to=peff@peff.net \
    --cc=dgutov@yandex.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.