Re: [PATCH 2/6] quote_path: give flags parameter to quote_path()
- From
Jeff King <peff@peff.net>
- Date
- Sep 10, 2020, 12:21 UTC
- Message-ID
- <20200910122111.GA57925@coredump.intra.peff.net>
- In-Reply-To
- <20200908205224.4126551-3-gitster@pobox.com>
On Tue, Sep 08, 2020 at 01:52:20PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> -char *quote_path(const char *in, const char *prefix, struct strbuf *out)
> +char *quote_path(const char *in, const char *prefix, struct strbuf *out, unsigned flags)
> {
> struct strbuf sb = STRBUF_INIT;
> const char *rel = relative_path(in, prefix, &sb);
> strbuf_reset(out);
> - quote_c_style_counted(rel, strlen(rel), out, NULL, 0);
> + quote_c_style_counted(rel, strlen(rel), out, NULL, flags);
> strbuf_release(&sb);Here we take "flags", but then we pass it along in place of quote_c_style_counted()'s "no_dq" parameter. That seems unlikely to be the right thing (and indeed, it's reverted in the next commit).
Show 8 quoted lines
> --- a/quote.h > +++ b/quote.h > @@ -72,7 +72,7 @@ void write_name_quoted_relative(const char *name, const char *prefix, > FILE *fp, int terminator); > > /* quote path as relative to the given prefix */ > -char *quote_path(const char *in, const char *prefix, struct strbuf *out); > +char *quote_path(const char *in, const char *prefix, struct strbuf *out, unsigned);
The meaning of the last parameter is left a bit vague. :) Maybe worth calling it "unsigned flags" (I don't mind omitting parameter names when they are obvious, but I don't think this counts).
-Peff