git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: stash-p broken?

From
Jeff King <peff@peff.net>
Date
Jul 31, 2014, 00:16 UTC
Message-ID
<20140731001627.GB22297@peff.net>
In-Reply-To
<xmqqlhrc2cfo.fsf@gitster.dls.corp.google.com>
On Tue, Jul 29, 2014 at 12:27:07PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I think that is my point, though. The user is _not_ aware that the
> > commit in question is a merge. They stashed some stuff, and now they
> > want to see the result. I'd like to show them a vanilla commit if the
> > index is irrelevant, and otherwise show them something more interesting.
> 
> I actually think "git stash list" users should be made very aware
> that they are looking at merge commits, and also what two states
> each of these merge commits represents.

Yeah, I kind of agree, but I also am not optimistic about most users understanding that. I was trying to gamble on the fact that:

  1. Naive users who do not understand the index will not stage files
     and then stash in the first place.  To them, the stash would be a
     simple diff between two states, the commit and the working tree.
  2. Advanced users would see the more complicated diff, but only
     because they were doing more interesting things with the index.
     They know what the index is, and therefore know that stash must be
     saving it somehow.

Of course that breaks down when the naive user somehow ends up with staged content in the index (e.g., they are resolving a merge and try to stash). Then they are thrust into the more complicated situation either way.

I dunno. I suspect that gamble would work _most_ of the time, and makes an OK default. On the other hand, "git stash list" was completely useless for showing diffs for many years, and since becoming useful has required "--cc" to show anything good. And this is the first complaint we've seen on the list. Maybe people don't actually care, and educating people to use "--cc -p" (or "--first-parent -p") is fine.

-Peff
Previous: Junio C Hamano
Message 12 of 12 in “stash-p broken?”
  1. Michael MigdolJul 29, 2014
  2. Michael MigdolJul 29, 2014
  3. brian m. carlsonJul 29, 2014
  4. Øystein WalleJul 29, 2014
  5. Jeff KingJul 29, 2014
  6. Junio C HamanoJul 29, 2014
  7. Jeff KingJul 29, 2014
  8. Junio C HamanoJul 29, 2014
  9. Jeff KingJul 31, 2014
  10. Junio C HamanoJul 31, 2014
  11. Junio C HamanoJul 29, 2014
  12. Jeff KingJul 31, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.