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

Re: [PATCH v2] stash: handle specifying stashes with spaces

From
Thomas Rast <tr@thomasrast.ch>
Date
Nov 29, 2013, 21:33 UTC
Message-ID
<878uw6dha7.fsf@thomasrast.ch>
In-Reply-To
<1385758845-8627-1-git-send-email-oystwa@gmail.com>
Thanks for looking into this!
Øystein Walle <oystwa@gmail.com> writes:
> -	REV=$(git rev-parse --quiet --symbolic --verify $1 2>/dev/null) || {
> +	REV=$(git rev-parse --quiet --symbolic --verify "$1" 2>/dev/null) || {
>  		reference="$1"

It's somewhat ironic that the one place where the original did use quoting is where it's actually not required.

> -	i_commit=$(git rev-parse --quiet --verify $REV^2 2>/dev/null) &&
> -	set -- $(git rev-parse $REV $REV^1 $REV: $REV^1: $REV^2: 2>/dev/null) &&
> +	i_commit=$(git rev-parse --quiet --verify "$REV^2" 2>/dev/null) &&
> +	set -- $(git rev-parse "$REV" "$REV^1" "$REV:" "$REV^1:" "$REV^2:" 2>/dev/null) &&
Thanks for being careful here.

I wonder what we would lose by dropping the --symbolic in the line I quoted above (which is the second parsing pass), so that it resolves to a SHA1. We would gain some robustness, as I'm not sure "$REV:" works correctly in the face of weird revision expressions like ":/foo".

-- 
Thomas Rast
tr@thomasrast.ch
Previous: Øystein WalleNext: Øystein Walle
Message 4 of 6 in “stash: handle specifying stashes with spaces”
  1. stash: handle specifying stashes with spacesØystein Walle, Nov 29, 2013
  2. Thomas RastNov 29, 2013
  3. stash: handle specifying stashes with spacesØystein Walle, Nov 29, 2013
  4. Thomas RastNov 29, 2013
  5. Øystein WalleNov 30, 2013
  6. Eric SunshineDec 1, 2013

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.