Re: [PATCH v3 1/4] quote: add c quote flag to ignore core.quotePath
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Feb 3, 2025, 09:51 UTC
- Message-ID
- <CAP8UFD2y=di9iKF+-nm90bg6zVnQ10OW+bvAyxTPM+xKpMYfLA@mail.gmail.com>
- In-Reply-To
- <20250201201658.11562-2-jltobler@gmail.com>
On Sat, Feb 1, 2025 at 9:20 PM Justin Tobler <jltobler@gmail.com> wrote:
> -static inline int cq_must_quote(char c) > +static inline int cq_must_quote(char c, int ignore_config)
I think it's a bit better to use 'unsigned int' instead of just 'int' for such flags, but it's fine here to use an 'int' because both `quote_path_fully` and `no_dq` below already use that type.
> - for (len = 0; len < maxlen && !cq_must_quote(s[len]); len++); > + for (len = 0; > + len < maxlen && !cq_must_quote(s[len], ignore_config); len++);
Micronit: If you really want to split the line into many lines, I think it might be better to go all the way like this:
for (len = 0;
len < maxlen && !cq_must_quote(s[len], ignore_config);
len++);Show 6 quoted lines
> @@ -83,7 +83,8 @@ int sq_dequote_to_strvec(char *arg, struct strvec *); > int unquote_c_style(struct strbuf *, const char *quoted, const char **endp); > > /* Bits in the flags parameter to quote_c_style() */ > -#define CQUOTE_NODQ 01 > +#define CQUOTE_NODQ (1u << 0)
Nice small cleanup which could be mentioned in the commit message if you reroll this series.
> +#define CQUOTE_IGNORE_CONFIG (1u << 1)