Skip to content

Commit 72e37b6

Browse files
committed
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 <[email protected]>
1 parent 6e8d46f commit 72e37b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/rev-parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
383383

384384
/* get the usage up to the first line with a -- on it */
385385
for (;;) {
386-
if (strbuf_getline_lf(&sb, stdin) == EOF)
386+
if (strbuf_getline(&sb, stdin) == EOF)
387387
die("premature end of input");
388388
ALLOC_GROW(usage, unb + 1, usz);
389389
if (!strcmp("--", sb.buf)) {
@@ -396,7 +396,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
396396
}
397397

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

0 commit comments

Comments
 (0)