diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-02-10 14:20:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-10 14:20:08 -0800 |
commit | 722c9244452c1853f0592b22c331382c282768c7 (patch) | |
tree | 51f432011324a752a2c57080e045a1fa7ad12c3f /builtin/check-ignore.c | |
parent | Merge branch 'aw/push-force-with-lease-reporting' (diff) | |
parent | apply, ls-files: simplify "-z" parsing (diff) | |
download | tgif-722c9244452c1853f0592b22c331382c282768c7.tar.xz |
Merge branch 'jk/options-cleanup'
Various clean-ups to the command line option parsing.
* jk/options-cleanup:
apply, ls-files: simplify "-z" parsing
checkout-index: disallow "--no-stage" option
checkout-index: handle "--no-index" option
checkout-index: handle "--no-prefix" option
checkout-index: simplify "-z" option parsing
give "nbuf" strbuf a more meaningful name
Diffstat (limited to 'builtin/check-ignore.c')
-rw-r--r-- | builtin/check-ignore.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 4f0b09e2db..1d73d3ca3d 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -115,20 +115,19 @@ static int check_ignore(struct dir_struct *dir, static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix) { - struct strbuf buf, nbuf; + struct strbuf buf = STRBUF_INIT; + struct strbuf unquoted = STRBUF_INIT; char *pathspec[2] = { NULL, NULL }; strbuf_getline_fn getline_fn; int num_ignored = 0; getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf; - strbuf_init(&buf, 0); - strbuf_init(&nbuf, 0); while (getline_fn(&buf, stdin) != EOF) { if (!nul_term_line && buf.buf[0] == '"') { - strbuf_reset(&nbuf); - if (unquote_c_style(&nbuf, buf.buf, NULL)) + strbuf_reset(&unquoted); + if (unquote_c_style(&unquoted, buf.buf, NULL)) die("line is badly quoted"); - strbuf_swap(&buf, &nbuf); + strbuf_swap(&buf, &unquoted); } pathspec[0] = buf.buf; num_ignored += check_ignore(dir, prefix, @@ -136,7 +135,7 @@ static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix) maybe_flush_or_die(stdout, "check-ignore to stdout"); } strbuf_release(&buf); - strbuf_release(&nbuf); + strbuf_release(&unquoted); return num_ignored; } |