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

Re: [Resend PATCH] t3903 (stash): add failing test for ref of form ^{/message}

From
Brandon Casey <drafnel@gmail.com>
Date
Apr 16, 2013, 21:29 UTC
Message-ID
<CA+sFfMd-pfmPXNCoAfH59om1cdYh1=bJ7yb-BGZHjkra5Gm_uw@mail.gmail.com>
In-Reply-To
<CALkWK0=L4mqVBqDMWgzN+BT5bnEF0L6d=GPXvrNhPL_Asvdq8Q@mail.gmail.com>

On Tue, Apr 16, 2013 at 1:11 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:

Show 26 quoted lines
> Brandon Casey wrote:
>>             # Save another stash here
>>
>>             echo bash >file
>>             git add file
>>             git stash save "something"
>>
>>             # Now git stash show stash^{/quuxery} no longer works.
>
> Ah, yes.  My stupidity.  Why was I expecting ^{/quuxery} to dig
> through the reflog?
>
>> An extension to the reflog dwimery that implements @{/<text>} could be
>> interesting though.
>
> Yeah, this sounds interesting.
>
> My initial itch that led up to this: I wanted a way to stash something
> away and recover it at a later time predictably for rebase.autostash
> (there might have been other stash invocations in between).
> Originally, I thought I'd need a refs/stashes/* or something of the
> sort to solve this problem, but git-stash.sh hard-codes refs/stash
> everywhere (and so do other things like reflog).  So, I was thinking
> about retrieving it based on commit message, but the solution is still
> short of ideal.  What are your thoughts on my original refs/stashes/*
> idea?

You can create a stash without modifying the refs/stash reflog using 'sha1=`git stash create`' and then later apply it using 'git stash apply --index $sha1'. You'll have to reset the work directory yourself though since 'git stash create' does not do so. The stash created this way is just a dangling commit so it will have a lifetime according to the gc.pruneexpire (default 2 weeks currently).

-Brandon
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 10 of 12 in “t3903 (stash): add failing test for ref of form ^{/message}”
  1. t3903 (stash): add failing test for ref of form ^{/message}Ramkumar Ramachandra, Apr 16, 2013
  2. Junio C HamanoApr 16, 2013
  3. Ramkumar RamachandraApr 16, 2013
  4. Junio C HamanoApr 16, 2013
  5. Brandon CaseyApr 16, 2013
  6. Junio C HamanoApr 16, 2013
  7. Brandon CaseyApr 16, 2013
  8. Ramkumar RamachandraApr 16, 2013
  9. Ramkumar RamachandraApr 16, 2013
  10. Brandon CaseyApr 16, 2013
  11. Ramkumar RamachandraApr 17, 2013
  12. Junio C HamanoApr 17, 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.