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

Re: [RFC/PATCH] pathspec: allow escaped query values

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2016, 19:29 UTC
Message-ID
<xmqqmvn3tmnm.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAPc5daWQYRbV_Oc-xCKE2R_O=aMBm_g_CLB=RPUam7EtbGPTgQ@mail.gmail.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> On Thu, Jun 2, 2016 at 11:42 AM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>>
>>> That would be workable, I would think.  Before attr:VAR=VAL
>>> extention, supported pathspec <magic> were only single lowercase-ascii
>>> alphabet tokens, so nobody would have used " as a part of magic.  So
>>> quting with double-quote pair would work.
>>
>> I was thinking about both ' and ", so that you could do:
>
> Yes, I understood your suggestion as such. Quoting like shells would work
> without breaking backward compatibility for the same reason quoting with
> double-quote and backslash only without supporting single-quotes would
> work.

Having said that, "It would work" does not have to mean "Hence we must do it that way" at all. Quoting character pairs make the parsing and unquoting significantly more complex.

As you said, not many people used attributes and pathspec magic, and I do not think those who want to use the new "further limits with attributes" magic, envisioned primarily to be those who want to give classes to submodules, have compelling reason to name their classes with anything but lowercase-ascii-alphabet tokens. So for a practical purposes, I'd rather see Stefan

 * just implement backquote-blindly-passes-the-next-byte and nothing
   more elaborate; and
 * forbid [^-a-z0-9,_] from being used in the value part in the
   attr:VAR=VAL magic.

at least for now, and concentrate more on the other more important parts of the submodule enhancement topic.

That way, those who will start using attr:VAR=VAL magic will stick themselves to lowercase-ascii-alphabet tokens for now (simply because an attribut that has the forbidden characters in its value would not be usable with the magic), and we can later extend the magic syntax parser in a backward compatible way to allow paired quotes and other "more convenient" syntax.

[Footnote]

*1* The reason I prefer to keep the initially allowed value characters narrow is because I envision that something like

	:(attr:VAR=(<some expression we will come up with later>))

may become necessary, and do not want to promise users that open or close parentheses will forever be taken literally.

Previous: Junio C HamanoNext: Ramsay Jones
Message 11 of 16 in “pathspec: allow escaped query values”
  1. pathspec: allow escaped query valuesStefan Beller, Jun 1, 2016
  2. Junio C HamanoJun 2, 2016
  3. Stefan BellerJun 2, 2016
  4. Ramsay JonesJun 2, 2016
  5. Stefan BellerJun 2, 2016
  6. Junio C HamanoJun 2, 2016
  7. Ramsay JonesJun 2, 2016
  8. Junio C HamanoJun 2, 2016
  9. Ramsay JonesJun 2, 2016
  10. Junio C HamanoJun 2, 2016
  11. Junio C HamanoJun 2, 2016
  12. Ramsay JonesJun 2, 2016
  13. Stefan BellerJun 2, 2016
  14. Ramsay JonesJun 2, 2016
  15. Junio C HamanoJun 2, 2016
  16. Ramsay JonesJun 2, 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.