Øystein Walle [off-list ref] writes:
However, when specifying a format string it's just a matter of ending
the format string in '%00' and you're good to go. But then you get the
null byte *and* a newline. And with your proposal there would be no way
of saying you want neither.
I very well understand that. All other commands that support "-z"
to give you NUL terminated output do not consider that a downside.
Why should for-each-ref be special?
Junio C Hamano <gitster <at> pobox.com> writes:
I very well understand that. All other commands that support "-z"
to give you NUL terminated output do not consider that a downside.
Why should for-each-ref be special?
After I discovered log also has this there is nothing special about
for-each-ref any longer, so my patch as-is would only make things less
consistent. What is "special" is that they give you the option of
supplying a format string.
ls-files, diff and others print a specific list of items (paths, shas,
...) and there's no question about how they are presented other than the
delimiter between each item, to which a selection of either a newline or
a null byte is plenty.
With log, for-each-ref and rev-list (any others?) that sort of breaks
down. With the format string you're given the power to make the command
print basically anything you like, however you like; no longer only a
question of mere delimiters. It only makes sense then (to me, at least)
that the command does not meddle with the format the user has chosen.
Maybe it's all subjective... I'm okay with just leaving things as they
are. There are ways around it.