Subject: Re: [PATCH 5/5] cat-file: Introduce new option to delimit output with NUL characters

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 Jun 2023 14:22:15 +0900

Patrick Steinhardt <[email-masked]> writes:

>> Hmph, I expected "-z" and "-Z" to be orthogonal, the former
>> controlling how input records are delimited, the latter controlling
>> how output records are delimited, as it usually is a good idea to
>> keep things that could be orthogonal to be orthogonal to avoid
>> unnecessarily robbing users flexibility.  "-Z is a new way that is
>> preferred over -z" was something I did not expect, actually.
>> 
>> I am not outright rejecting such a deliberately limiting design, but
>> I'll have to think about it a bit.
>
> Well, the way I see it we shouldn't have ever decoupled the input and
> output format, and I consider it a bug that `-z` did as it makes it
> unusable with arbitrary input. So I'd rather be helping the user of
> these modes to do the right thing and NUL-delimit both input and output
> than running into these edge cases later down the road.

If that is the direction we want to go in, then the title of this
step must be updated to say "-Z" does both output and input.  Also
with the same number of bytes it takes to say "new option", you can
say what that new option is, so do that.

> That being said I'd be fine to change this series to mean "-Z changes
> stdout" if you insist. In that case we should be pointing out in our
> documentation that "You should never use `-z` without `-Z` when you
> process arbitrary input".

You are not making sense.  If we were to leave them orthogonal to
keep flexibility, it is because there can be cases where using '-Z'
without using '-z' (and vice versa) makes sense; "you should never"
has no place to live in such a world.