summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2010-06-12 12:57:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-13 16:38:14 (GMT)
commit47e9cd28f8a404a0d6293935252ddca5fc243931 (patch)
tree8a3c80aa6b82fdec17271ec3abaeb16798a66fb3 /builtin
parent9c7304e3e39ed397b3cc6566573333e2698a52b4 (diff)
downloadgit-47e9cd28f8a404a0d6293935252ddca5fc243931.zip
git-47e9cd28f8a404a0d6293935252ddca5fc243931.tar.gz
git-47e9cd28f8a404a0d6293935252ddca5fc243931.tar.bz2
parseopt: wrap rev-parse --parseopt usage for eval consumption
9c7304e (print the usage string on stdout instead of stderr, 2010-05-17) broke rev-parse --parseopt: when run with -h, the usage notice on stdout ended up in the shell eval. Wrap the usage in a cat <<\EOF ... EOF block when printing to stdout. I do not expect any usage lines to ever start with EOF so this shouldn't be an undue burden. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rev-parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 8fbf9d0..b676e29 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -408,7 +408,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
memset(opts + onb, 0, sizeof(opts[onb]));
argc = parse_options(argc, argv, prefix, opts, usage,
keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |
- stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);
+ stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0 |
+ PARSE_OPT_SHELL_EVAL);
strbuf_addf(&parsed, " --");
sq_quote_argv(&parsed, argv, 0);