Re: [PATCH v3 1/4] quote: add c quote flag to ignore core.quotePath
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Feb 4, 2025, 22:50 UTC
- Message-ID
- <i4nwrzqjhuvo26kt45aykazut7rgvhh5w474dkqay3fhmnuvtx@czemalalwuwm>
- In-Reply-To
- <xmqqikppvf2t.fsf@gitster.g>
On 25/02/04 08:40AM, Junio C Hamano wrote:
Show 34 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: > > > So regardless of what the future default value of core.quotePath > > would be, I am not convinced that it is a good idea to octal quote > > any and all bytes outside the ASCII range in the rev-list output. > > > > After all, "git rev-list --objects" would show such a path without > > quoting, no [*]? > > > > Side note: the path in the output from "git rev-list --objects" > > is a hack to allow receiving end to compute a path hash, and > > does not have to be strictly reversible, so it emits verbatim > > bytes but truncates the output at LF to preserve the one-line > > one-object output format. > > > > We do need to quote certain bytes (e.g., LF cannot be allowed > > verbatim, when the output is line-oriented, and we use C-quote, > > which means literal double-quote needs to be also quoted), so we > > cannot mimic paths emitted by "git rev-list --objects", but I do not > > think it buys us much to quote non-ASCII bytes these days. > > Rereading this I realize that I was not quite making sense. > > A short version of what I wanted to say is: > > - The output format need to do some quoting anyway because it is > inevitable to make the string stuffed as "value" in a space > separated list of var=value on a single line. > > - It does not really matter if core.quotePath allows us to pass > bytes with 8-bit set (e.g. UTF-8 outside ASCII) unquoted or > require quoting. The receiving end must be prepared to unquote, > so it is dubious that a new feature to ignore core.quotePath is > needed.
I agree, thinking about this some more, forcing the value quoting behavior to act as if core.quotePath is always enabled is a step in the wrong direction. If anything, we could force it disabled to be more friendly to non-ASCII characters, but that is probably not worth it either.
> - We do need to quote SP that cquote does not require quoting, so > some wrapping around quote_c_style() like quote_path() does is > needed.
I think using quote_path() as-is should be sufficient. I'll drop the first two patches from this series in the next version I send and adapt accordingly.
Thanks -Justin