On Tue, Oct 25, 2016 at 4:11 AM, Jeff King <peff@xxxxxxxx> wrote: > 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@xxxxxxxxx> >> --- > > 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