Skip to content

Commit

Permalink
rev-parse: read parseopt spec with strbuf_getline()
Browse files Browse the repository at this point in the history
"rev-parse --parseopt" specification is clearly text and we
should anticipate that we may be fed CRLF lines.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jan 15, 2016
1 parent 6e8d46f commit 72e37b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions builtin/rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -396,7 +396,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
}

/* parse: (<short>|<short>,<long>|<long>)[*=?!]*<arghint>? SP+ <help> */
while (strbuf_getline_lf(&sb, stdin) != EOF) {
while (strbuf_getline(&sb, stdin) != EOF) {
const char *s;
const char *help;
struct option *o;
Expand Down

0 comments on commit 72e37b6

Please sign in to comment.