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

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

From
Øystein Walle <oystwa@gmail.com>
Date
Nov 30, 2013, 15:29 UTC
Message-ID
<loom.20131130T153012-412@post.gmane.org>
In-Reply-To
<878uw6dha7.fsf@thomasrast.ch>
Thomas Rast <tr <at> thomasrast.ch> writes:
Show 5 quoted lines
> 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".

If I drop --symbolic then all hell breaks loose. Removing it very naively led to 29 failed tests. I managed to get that down quite a bit though.

After the function ends $REV is supposed to expand to a symbolic reference, and the test for whether the given argument is a valid stash reference is to see if running `git rev-parse --symbolic-full-name "${REV%@*}"` expands to 'refs/stash' or not. So we have to do both with and without --symbolic and keep both around. For example `git stash drop` had problems because git-reflog doesn't let you remove entries in the log by SHA1:

    $ git reflog delete --updateref --rewrite $(git rev-parse stash@{0})
    error: Not a reflog: 418af27beea220ad8a2fd3b8286959b1ec9c8852

I think a not entirely accurate but succinct way of putting it is that if foo is a valid ref or valid entry in the reflog then

    git rev-parse --symbolic $(git rev-parse foo) 

does *not* output 'foo' but the SHA1 of 'foo'. So we cannot simply convert everything to hashes and proceed from there.

Øsse
Previous: Thomas RastNext: Eric Sunshine
Message 5 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.