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/update-index.c | |
parent | 24abb31727e8e0b216bdee182dbbbbc43d134fa6 (diff) | |
parent | 1f3c79a9d6c3278753e7fb63b48569a9ff8632df (diff) | |
download | git-722c9244452c1853f0592b22c331382c282768c7.tar.gz |
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/update-index.c')
-rw-r--r-- | builtin/update-index.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c index dbc23a46b1..1c94ca59bf 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1086,16 +1086,17 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) } if (read_from_stdin) { - struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT; + struct strbuf buf = STRBUF_INIT; + struct strbuf unquoted = STRBUF_INIT; setup_work_tree(); while (getline_fn(&buf, stdin) != EOF) { char *p; 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); } p = prefix_path(prefix, prefix_length, buf.buf); update_one(p); @@ -1103,7 +1104,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) chmod_path(set_executable_bit, p); free(p); } - strbuf_release(&nbuf); + strbuf_release(&unquoted); strbuf_release(&buf); } |