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

Re: [PATCH] stash: allow ref of a stash by index

From
Jeff King <peff@peff.net>
Date
Sep 5, 2016, 23:52 UTC
Message-ID
<20160905235207.jkxmnrwoc6lllomk@sigill.intra.peff.net>
In-Reply-To
<CAFaJEqu-JUcwLjrQBk_huSa3DZfCf8O4eAZ=UgcXHzN=CLgtpw@mail.gmail.com>
On Mon, Sep 05, 2016 at 11:46:34PM +0200, Øystein Walle wrote:
Show 7 quoted lines
> The bash-specific code is a no-go, so here's a way to do it in a way
> that I think is in line with Git's code style for shell scripts. I took
> the liberty of removing the '|| exit 1' since the rev is verified later
> on anyway, as can be seen in the last piece of context. That way the
> argument munging can be done at a later stage where we don't have to
> loop over multiple ones. The first rev-parse's purpose is just to apply
> --sq.

I wondered how that would impact the error message when there is no such stash. It looks like rev-parse will still return the bogus name on stdout, so we do not run afoul of the "No stash found" code path. We do get:

  $ git.compile stash show foobar
  foobar is not a valid reference
instead of:
  $ git stash show foobar
  fatal: ambiguous argument 'foobar': unknown revision or path not in
  the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'

But I do not see that as a big downside (I might even call it an improvement).

-Peff
Previous: Øystein WalleNext: Junio C Hamano
Message 8 of 9 in “stash: allow ref of a stash by index”
  1. stash: allow ref of a stash by indexAaron M Watson, Sep 3, 2016
  2. Jeff KingSep 4, 2016
  3. Junio C HamanoSep 4, 2016
  4. Johannes SchindelinSep 4, 2016
  5. Philip OakleySep 4, 2016
  6. Øystein WalleSep 5, 2016
  7. Øystein WalleSep 5, 2016
  8. Jeff KingSep 5, 2016
  9. Junio C HamanoSep 7, 2016

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.