Re: [PATCH 0/4] rev-list: introduce NUL-delimited output mode
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Mar 19, 2025, 15:58 UTC
- Message-ID
- <2aqtmbdpzi5lupflthm4rvoya3pqksv4sqnv5if6camw7tkzuz@ydecphmvo4dc>
- In-Reply-To
- <xmqqtt7ve2id.fsf@gitster.g>
On 25/03/14 02:16PM, Junio C Hamano wrote:
Show 30 quoted lines
> Justin Tobler <jltobler@gmail.com> writes:
>
> > If we want to adopt less ambiguous long options names for NUL-delimited
> > input/output options as an alternative to "-z", maybe we could do
> > something like:
> >
> > $ git rev-list --nul-delimited={all,input,output}
> >
> > where the default for the `--nul-delimited` could be both input/output.
>
> I'd prefer not to see that route taken, as it does not look any
> "less ambiguous" at least to me. Making individual selections are
> almost the same in either syntax, and the only difference is that
> --nul-delimited-input --nul-delimited-output can be independently
> chosen and given and happen to end up selecting both.
>
> But with --nul-delimited=<value>, you have to plan ahead and choose
> "all". When your script first wants NUL delimited I/O on the output
> side, you'd write "output". When later you want to allow it to
> optionally take NUL delimited I/O on the input side, you have to
> notice that you have "output" there already and replace it with "all".
> If the initial version did not have NUL-delimited output, your change
> to add support for NUL-delimited input would be different.
>
> And you also have to remember that it has to be spelled "all" and
> not "both" when you replace existing "output".
>
> In other words, I'd prefer to leave independent/orthogonal things as
> such, even if such a general design principle may make the result a
> bit more verbose, at the plumbing level.That's fair. I agree the explicitness of having two separate options is nice and, while more verbose, that is probably not a big deal at the plumbing level.
In my next version I'll return the "-z" option to only setting the output to be NUL-delimited which would better match the log family of commands. If we also want to support NUL-delimited stdin parsing, I can submit a followup series which teaches git-rev-list(1) the "--nul-delimited-{input,output}" options.
On a side note, I also noticed that git-commit(1) uses the "--null" option as an alias to "-z". I think it would be nice if going forward there was greater consistency around the options used to control input/output delimiters. Maybe "--nul-delimited-{input,output}" could be that in the future.
Thanks, -Justin