From: Junio C Hamano Date: Wed, 16 Dec 2015 22:03:09 GMT Subject: [PATCH v2 08/17] rev-parse: read parseopt spec with strbuf_getline_crlf() Message-ID: <1450303398-25900-9-git-send-email-gitster@pobox.com> In-Reply-To: <1450303398-25900-1-git-send-email-gitster@pobox.com> "rev-parse --parseopt" specification is clearly text and we should anticipate that we may be fed CRLF lines. Signed-off-by: Junio C Hamano --- builtin/rev-parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 02d747d..f2cf99c 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -386,7 +386,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix) /* get the usage up to the first line with a -- on it */ for (;;) { - if (strbuf_getline(&sb, stdin, '\n') == EOF) + if (strbuf_getline_crlf(&sb, stdin) == EOF) die("premature end of input"); ALLOC_GROW(usage, unb + 1, usz); if (!strcmp("--", sb.buf)) { @@ -399,7 +399,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix) } /* parse: (|,|)[*=?!]*? SP+ */ - while (strbuf_getline(&sb, stdin, '\n') != EOF) { + while (strbuf_getline_crlf(&sb, stdin) != EOF) { const char *s; const char *help; struct option *o; -- 2.7.0-rc1-83-ga8b6b9e