From: Junio C Hamano Date: Wed, 28 Oct 2015 20:59:44 +0000 (-0700) Subject: rev-parse: read parseopt spec with strbuf_getline() X-Git-Tag: v2.8.0-rc0~85^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72e37b6ac851c3926956c9d11a40260f08bf1c5e;p=thirdparty%2Fgit.git rev-parse: read parseopt spec with strbuf_getline() "rev-parse --parseopt" specification is clearly text and we should anticipate that we may be fed CRLF lines. Signed-off-by: Junio C Hamano --- diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 0324abb749..bd16876df5 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -383,7 +383,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_lf(&sb, stdin) == EOF) + if (strbuf_getline(&sb, stdin) == EOF) die("premature end of input"); ALLOC_GROW(usage, unb + 1, usz); if (!strcmp("--", sb.buf)) { @@ -396,7 +396,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix) } /* parse: (|,|)[*=?!]*? SP+ */ - while (strbuf_getline_lf(&sb, stdin) != EOF) { + while (strbuf_getline(&sb, stdin) != EOF) { const char *s; const char *help; struct option *o;