Re: [PATCH 1/2] alternates: accept double-quoted paths
- From
Jeff King <peff@peff.net>
- Date
- Dec 13, 2016, 11:52 UTC
- Message-ID
- <20161213115218.7arxxatus7qjdu2m@sigill.intra.peff.net>
- In-Reply-To
- <CACsJy8B52ZDRTUjGLqub_1wELtugv99xbDnBg1PX1LUTb6nVMQ@mail.gmail.com>
On Tue, Dec 13, 2016 at 06:30:15PM +0700, Duy Nguyen wrote:
Show 18 quoted lines
> On Tue, Dec 13, 2016 at 2:52 AM, Jeff King <peff@peff.net> wrote: > > Instead, let's treat names as unquoted unless they begin > > with a double-quote, in which case they are interpreted via > > our usual C-stylke quoting rules. This also breaks > > backwards-compatibility, but in a smaller way: it only > > matters if your file has a double-quote as the very _first_ > > character in the path (whereas an escape character is a > > problem anywhere in the path). It's also consistent with > > many other parts of git, which accept either a bare pathname > > or a double-quoted one, and the sender can choose to quote > > or not as required. > > At least attr has the same problem and is going the same direction > [1]. Cool. (I actually thought the patch was in and evidence that this > kind of backward compatibility breaking was ok, turns out the patch > has stayed around for years) > > [1] http://public-inbox.org/git/%3C20161110203428.30512-18-sbeller@google.com%3E/
Thanks for digging that up. As soon as I came up with the idea[1], I wanted to use the attr code as an example of a similar problem and solution, but I couldn't find it in the code. Which makes sense if it wasn't merged.
I do think it's a pretty reasonable approach in general, and would be OK for the attributes code.
-Peff
[1] One could argue that I did not come up with the idea at all, but
rather just remembered that somebody else had done so. :)