Re: [PATCH v2 04/17] update-index: read list of paths with strbuf_getline_crlf() under --stdin
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 4, 2016, 12:27 UTC
- Message-ID
- <alpine.DEB.2.20.1601041314240.14434@virtualbox>
- In-Reply-To
- <1450303398-25900-5-git-send-email-gitster@pobox.com>
Hi Junio,
On Wed, 16 Dec 2015, Junio C Hamano wrote:
Show 15 quoted lines
> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index a7a9a7e..3a6c5b2 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -1075,7 +1075,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
> struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
>
> setup_work_tree();
> - while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
> +
> + while ((line_termination
> + ? strbuf_getline_crlf(&buf, stdin)
> + : strbuf_getline(&buf, stdin, '\0')) != EOF) {
> char *p;
> if (line_termination && buf.buf[0] == '"') {Again, I think it would make things clearer and more future proof if we changed the logic to talk about nul_delimited instead of line_termination.
Ciao, Dscho