<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/quote.c, branch v2.40.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-07-26T19:01:25Z</updated>
<entry>
<title>ref-filter: --format=%(raw) support --perl</title>
<updated>2021-07-26T19:01:25Z</updated>
<author>
<name>ZheNing Hu</name>
<email>adlternative@gmail.com</email>
</author>
<published>2021-07-26T03:26:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7121c4d4e2877115fb372b3f147fad4cd1306751'/>
<id>urn:sha1:7121c4d4e2877115fb372b3f147fad4cd1306751</id>
<content type='text'>
Because the perl language can handle binary data correctly,
add the function perl_quote_buf_with_len(), which can specify
the length of the data and prevent the data from being truncated
at '\0' to help `--format="%(raw)"` support `--perl`.

Reviewed-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Helped-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: ZheNing Hu &lt;adlternative@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote: make sq_dequote_step() a public function</title>
<updated>2021-01-12T20:03:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-01-12T12:26:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13c44953fb0b396d3594b4a712f956ab3a48169e'/>
<id>urn:sha1:13c44953fb0b396d3594b4a712f956ab3a48169e</id>
<content type='text'>
We provide a function for dequoting an entire string, as well as one for
handling a space-separated list of quoted strings. But there's no way
for a caller to parse a string like 'foo'='bar', even though it is easy
to generate one using sq_quote_buf() or similar.

Let's make the single-step function available to callers outside of
quote.c. Note that we do need to adjust its implementation slightly: it
insists on seeing whitespace between items, and we'd like to be more
flexible than that. Since it only has a single caller, we can move that
check (and slurping up any extra whitespace) into that caller.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote: turn 'nodq' parameter into a set of flags</title>
<updated>2020-09-10T20:08:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c37c9750a0b402a68c73d0e4644f538a026d121'/>
<id>urn:sha1:7c37c9750a0b402a68c73d0e4644f538a026d121</id>
<content type='text'>
quote_c_style() and its friend quote_two_c_style() both take an
optional "please omit the double quotes around the quoted body"
parameter.  Turn it into a flag word, assign one bit out of it,
and call it CQUOTE_NODQ bit.

No behaviour change intended.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote: rename misnamed sq_lookup[] to cq_lookup[]</title>
<updated>2020-09-10T20:07:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dfc7f65c261e923a41c910a11390d487e66eb6fe'/>
<id>urn:sha1:dfc7f65c261e923a41c910a11390d487e66eb6fe</id>
<content type='text'>
This table is used to see if each byte needs quoting when responding
to a request to C-quote the string, not quoting with single-quote in
the shell style.  Similarly, sq_must_quote() is fed each byte from
the string being C-quoted.

No behaviour change intended.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote_path: code clarification</title>
<updated>2020-09-10T20:07:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2773aa45f673d26fe425cc5423299726f299f0b'/>
<id>urn:sha1:e2773aa45f673d26fe425cc5423299726f299f0b</id>
<content type='text'>
The implementation we moved from wt-status to enclose a pathname
that has a SP in it inside a dq-pair is a bit convoluted.  It lets
quote_c_style_counted() do its escaping and then

 (1) if the input string got escaped, which is checked by seeing if
     the result begins with a double-quote, declare that we are
     done.  If there wasn't any SP in the input, that is OK, and if
     there was, the result is quoted already so it is OK, too.

 (2) if the input string did not get escaped, and the result has SP
     in it, enclose the whole thing in a dq-pair ourselves.

Instead we can scan the path upfront to see if the input has SP in
it.  If so, we tell quote_c_style_counted() not to enclose its
output in a dq-pair, and we add a dq-pair ourselves.  Whether the
input had bytes that quote_c_style_counted() uses backslash quoting,
this would give us a desired quoted string.  If the input does not
have SP in it, we just let quote_c_style_counted() do its thing as
usual, which would enclose the result in a dq-pair only when needed.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote_path: optionally allow quoting a path with SP in it</title>
<updated>2020-09-10T17:49:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f3fc4a1b8680c114defd98ce6f2429f8946a5dc1'/>
<id>urn:sha1:f3fc4a1b8680c114defd98ce6f2429f8946a5dc1</id>
<content type='text'>
Some code in wt-status.c special case a path with SP in it, which
usually does not have to be c-quoted, and ensure that such a path
does get quoted.  Move the logic to quote_path() and give it a bit
in the flags word, QUOTE_PATH_QUOTE_SP.

No behaviour change intended.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote_path: give flags parameter to quote_path()</title>
<updated>2020-09-10T17:49:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88910c9939cee927a3ed1acca8d33a30c90b8fe5'/>
<id>urn:sha1:88910c9939cee927a3ed1acca8d33a30c90b8fe5</id>
<content type='text'>
The quote_path() function computes a path (relative to its base
directory) and c-quotes the result if necessary.  Teach it to take a
flags parameter to allow its behaviour to be enriched later.

No behaviour change intended.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote_path: rename quote_path_relative() to quote_path()</title>
<updated>2020-09-10T17:49:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-10T17:01:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c34d24b8a4d776a0046261b7fc6d0900ea94cc52'/>
<id>urn:sha1:c34d24b8a4d776a0046261b7fc6d0900ea94cc52</id>
<content type='text'>
There is no quote_path_absolute() or anything that causes confusion,
and one of the two large consumers already rename the long name
locally with a preprocessor macro.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strvec: convert remaining callers away from argv_array name</title>
<updated>2020-07-28T22:02:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-07-28T20:25:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c972bf4cf546a56fe1c54ddde1d33ebb9f454a0f'/>
<id>urn:sha1:c972bf4cf546a56fe1c54ddde1d33ebb9f454a0f</id>
<content type='text'>
We eventually want to drop the argv_array name and just use strvec
consistently. There's no particular reason we have to do it all at once,
or care about interactions between converted and unconverted bits.
Because of our preprocessor compat layer, the names are interchangeable
to the compiler (so even a definition and declaration using different
names is OK).

This patch converts all of the remaining files, as the resulting diff is
reasonably sized.

The conversion was done purely mechanically with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe '
    s/ARGV_ARRAY/STRVEC/g;
    s/argv_array/strvec/g;
  '

We'll deal with any indentation/style fallouts separately.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>quote: rename sq_dequote_to_argv_array to mention strvec</title>
<updated>2020-07-28T22:02:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-07-28T20:24:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2745b6b4505ae11d6821c1d451169727b558a079'/>
<id>urn:sha1:2745b6b4505ae11d6821c1d451169727b558a079</id>
<content type='text'>
We want to eventually drop the use of the "argv_array" name in favor of
"strvec." Unlike most other uses of the name, this one is embedded in a
function name, so the definition and all of the callers need to be
updated at the same time.

We don't technically need to update the parameter types here (our
preprocessor compat macros make the two names interchangeable), but
let's do so to keep the site consistent for now.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
