Clemens Buchacher [off-list ref] writes:
Avoid copying to strbuf in case a subset of the original string can
be returned.
Since the strbuf is no longer guaranteed to be updated, this
function is different from quote_path_relative(). To avoid
confusion, do not export it.
Signed-off-by: Clemens Buchacher <redacted>
The version of path_relative() after this patch looks much easier to
follow.
I noticed that there is a similar function write_name_quotedpfx() defined
in the same file, and wondered if we can do something similar to avoid the
whole allocation business. But that would only be a microoptimize useful
for write_name_quoted_relative() and not for quote_path_relative() that
has a lot more callers, so it would probably not be worth it.
Thanks.