Re: [PATCH] stash: allow ref of a stash by index
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Sep 4, 2016, 07:21 UTC
- Message-ID
- <alpine.DEB.2.20.1609040914200.129229@virtualbox>
- In-Reply-To
- <20160904015209.ba6arov46ntr2ouq@sigill.intra.peff.net>
Hi,
On Sat, 3 Sep 2016, Jeff King wrote:
Show 14 quoted lines
> On Sat, Sep 03, 2016 at 07:21:18PM -0400, Aaron M Watson wrote:
>
> > Allows stashes to be referenced by index only. Instead of referencing
> > "stash@{n}" explicitly, it can simply be referenced as "n".
>
> This says "what" but not "why". I assume it is "because the former is
> more annoying to type".
>
> Are there any backwards-compatibility issues you can think of?
>
> I think that "123456" could be a sha1, but I do not see much point in
> referencing a sha1 as the argument of "stash show". And it looks like
> this code path is called only from is_stash_like(), so presumably the
> same logic would apply to other callers.Maybe we could make it unambiguous, e.g. by using #<n> instead: #123456 cannot refer to a SHA-1.
But then, '#' are comment-starting in shells, so they would have to by escaped. Maybe the best option would be to introduce a -n <n> option, with the shortcut -<n> thanks to e0319ff (parseopt: add OPT_NUMBER_CALLBACK, 2009-05-07).
Ciao, Johannes