Re: [PREVIEW v3 4/9] mktree: there are only two line terminators
- From
Jeff King <peff@peff.net>
- Date
- Jan 14, 2016, 10:11 UTC
- Message-ID
- <20160114101114.GB30772@sigill.intra.peff.net>
- In-Reply-To
- <1452740590-16827-5-git-send-email-gitster@pobox.com>
On Wed, Jan 13, 2016 at 07:03:04PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> @@ -141,23 +141,25 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
> {
> struct strbuf sb = STRBUF_INIT;
> unsigned char sha1[20];
> - int line_termination = '\n';
> + int lf_lines = 1;
> int allow_missing = 0;
> int is_batch_mode = 0;
> int got_eof = 0;
> + strbuf_getline_fn getline_fn;
>
> const struct option option[] = {
> - OPT_SET_INT('z', NULL, &line_termination, N_("input is NUL terminated"), '\0'),
> + OPT_SET_INT('z', NULL, &lf_lines, N_("input is NUL terminated"), '\0'),Using '\0' isn't wrong here, but should it now just be "0", since it's no longer meant to be a "char"?
Also, I notice that other patches in the series flip the logic (instead of "lf_lines", we get its inverse, "nul_term_line"). That lets us use the more obvious "OPT_BOOL" here.
-Peff