From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: bär <crashcookie@gmail.com>,
"Jonathan Kamens" <jkamens@quantopian.com>,
"Git List" <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] stash: require a clean index to apply
Date: Mon, 15 Jun 2015 10:42:18 -0700 [thread overview]
Message-ID: <xmqqsi9samx1.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150610192734.GA23715@peff.net> (Jeff King's message of "Wed, 10 Jun 2015 15:27:35 -0400")
Jeff King <peff@peff.net> writes:
> It seems like applying a stash made with "-k" is fundamentally
> misdesigned in the current code. We would want to apply to the working
> tree the difference between the index and the working tree, but instead
> we try to apply the difference between the HEAD and the working tree.
> Which is nonsensical for this use case (i.e., to apply the diff between
> $stash and $stash^2, not $stash^1).
>
> I don't think there is any way to tell that "-k" was used, though. But
> even if the user knew that, I do not think there is any option to tell
> "stash apply" to do it this way.
>
> I dunno. With respect to the original patch, I am OK if we just want to
> revert it. This area of stash seems a bit under-designed IMHO, but if
> people were happy enough with it before, I do not think the safety
> benefit from ed178ef is that great (it is not saving you from destroying
> working tree content, only the index state; the individual content blobs
> are still available from git-fsck).
Yeah, I agree. Somebody care to do the log message?
This is a tangent, but I'd actually not just agree with "'stash -k'
is a bit under-designed" but also would say something stronger than
that, IMHO ;-)
The very original idea of "git stash" to ssave away working tree
changes with respect to HEAD without bothering the index was at
least internally consistent. You save away and then may later pop
the change on top of a different commit after dealing with an
emergency, at which time there may be conflicts that you would need
to resolve, and because it is only between HEAD and working tree,
you can safely use the index to resolve the conflicts just like in
any other situation when you help Git to resolve them. In that
context, the flaw ed178ef1 (stash: require a clean index to apply,
2015-04-22) tried to correct made a lot of sense.
What broke the entire system was the throwing the "save the index,
too" into the mix, which was done without careful thinking. While
it made the command more useful (when it works), it made the command
internally inconsistent---the command has to punt restoring index
state when it can't, for example, losing the state it tried to save.
I think that is where the "under-designed" started, I would think;
of course, "-k" needed to build on top of "save also the index",
but that is not the primary culprit.
next prev parent reply other threads:[~2015-06-15 17:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 0:43 [PATCH 3/3] stash: require a clean index to apply Jonathan Kamens
2015-06-07 12:40 ` Jeff King
2015-06-07 12:47 ` Jeff King
2015-06-10 18:19 ` bär
2015-06-10 18:56 ` Jeff King
2015-06-10 19:16 ` Junio C Hamano
2015-06-10 19:27 ` Jeff King
2015-06-10 21:54 ` bär
2015-06-15 17:42 ` Junio C Hamano [this message]
2015-06-15 18:27 ` [PATCH] Revert "stash: require a clean index to apply" Jeff King
2015-06-15 20:11 ` Junio C Hamano
2015-06-25 21:51 ` Jonathan Kamens
[not found] ` <f06e573d-02e3-47e9-85d8-3bb6551d72f5.maildroid@localhost>
2015-06-26 0:27 ` Jeff King
2015-06-26 1:12 ` Jonathan Kamens
2015-06-26 4:03 ` Jeff King
2015-06-26 4:15 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2015-04-22 19:29 How do I resolve conflict after popping stash without adding the file to index? Jeff King
2015-04-22 19:31 ` [PATCH 3/3] stash: require a clean index to apply Jeff King
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=xmqqsi9samx1.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=crashcookie@gmail.com \
--cc=git@vger.kernel.org \
--cc=jkamens@quantopian.com \
--cc=peff@peff.net \
/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.