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

Re: [PATCH] Allow stashes to be referenced by index only

From
Aaron and Ashley Watson <watsona4@gmail.com>
Date
Oct 25, 2016, 08:20 UTC
Message-ID
<CAB0+k9KWLo-cBGceJ5fzU41ZKbbii5dbxy5TYUbOhybivKcWGg@mail.gmail.com>
In-Reply-To
<20161025081149.x5l5zcupva546ssf@sigill.intra.peff.net>
On Tue, Oct 25, 2016 at 4:11 AM, Jeff King <peff@peff.net> wrote:
Show 42 quoted lines
> On Mon, Oct 24, 2016 at 07:40:13PM -0400, Aaron M Watson wrote:
>
>> Instead of referencing "stash@{n}" explicitly, it can simply be
>> referenced as "n".  Most users only reference stashes by their position
>> in the stash stask (what I refer to as the "index"). The syntax for the
>> typical stash (stash@{n}) is slightly annoying and easy to forget, and
>> sometimes difficult to escape properly in a script. Because of this the
>> capability to do things with the stash by simply referencing the index
>> is desirable.
>>
>> This patch includes the superior implementation provided by Øsse Walle
>> (thanks for that), with a slight change to fix a broken test in the test
>> suite. I also merged the test scripts as suggested by Jeff King, and
>> un-wrapped the documentation as suggested by Junio Hamano.
>>
>> Signed-off-by: Aaron M Watson <watsona4@gmail.com>
>> ---
>
> Thanks, this version looks good to me.
>
> Oddly, it does not seem to apply. I get:
>
>   $ git am -3 ~/patch
>   Applying: Allow stashes to be referenced by index only
>   Using index info to reconstruct a base tree...
>   M       git-stash.sh
>   error: patch failed: t/t3903-stash.sh:604
>   error: t/t3903-stash.sh: patch does not apply
>   error: Did you hand edit your patch?
>   It does not apply to blobs recorded in its index.
>   Patch failed at 0001 Allow stashes to be referenced by index only
>
> The culprit seems to be the final hunk header:
>
>> @@ -604,7 +624,21 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
>
> This should be "604,6", as there are 6 context lines, and your patch
> does not remove any lines.
>
> I suspect the maintainer can fix it up while applying, but for my
> curiosity: did you hand-edit it, or is there a potential bug in git's
> diff code?

I did indeed edit the patch by hand (I forgot to remove the spaces after the > in the test file), but the bug appears to be in emacs's diff-mode, not in git.

>
> -Peff
-- 
Aaron and Ashley Watson
Previous: Jeff KingNext: Junio C Hamano
Message 5 of 8 in “Allow stashes to be referenced by index only”
  1. Allow stashes to be referenced by index onlyAaron M Watson, Sep 8, 2016
  2. Jeff KingOct 23, 2016
  3. Allow stashes to be referenced by index onlyAaron M Watson, Oct 24, 2016
  4. Jeff KingOct 25, 2016
  5. Aaron and Ashley WatsonOct 25, 2016
  6. Junio C HamanoOct 25, 2016
  7. Ramsay JonesOct 26, 2016
  8. Jeff KingOct 24, 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.