summaryrefslogtreecommitdiff
path: root/t/t1502-rev-parse-parseopt.sh
AgeCommit message (Collapse)Author
2013-10-31rev-parse --parseopt: add the --stuck-long modeNicolas Vigier
Add the --stuck-long option to output the options in their long form if available, and with their arguments stuck. Contrary to the default form (non stuck arguments and short options), this can be parsed unambiguously when using options with optional arguments : - in the non stuck form, when an option is taking an optional argument you cannot know if the next argument is its optional argument, or the next option. - the long options form allows to differentiate between an empty argument '--option=' and an unset argument '--option', which is not possible with short options. Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-27Fix tests under GETTEXT_POISON on parseoptJiang Xin
Use the i18n-specific test functions in test scripts for parseopt tests. This issue was was introduced in v1.7.10.1-488-g54e6d: 54e6d i18n: parseopt: lookup help and argument translations when showing usage and been broken under GETTEXT_POISON=YesPlease since. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t1502 (rev-parse --parseopt): test exit code from "-h"Jonathan Nieder
rev-parse --parseopt exits with code 129 (usage error) when asked to dump usage with -h on behalf of another command. Scripts can take advantage of this to avoid trying to parse usage information as though it were the regular output from some git command. Noticed with an &&-chaining tester. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-07Merge branch 'maint'Junio C Hamano
* maint: backmerge a few more fixes to 1.7.1.X series rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option fix git branch -m in presence of cross devices Conflicts: RelNotes builtin/rev-parse.c
2010-07-07rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-optionUwe Kleine-König
The ?: operator has a lower priority than |, so the implicit associativity made the 6th argument of parse_options be PARSE_OPT_KEEP_DASHDASH if keep_dashdash was true discarding PARSE_OPT_STOP_AT_NON_OPTION and PARSE_OPT_SHELL_EVAL. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13parseopt: wrap rev-parse --parseopt usage for eval consumptionThomas Rast
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>
2010-06-01print the usage string on stdout instead of stderrGiuseppe Scrivano
When -h is used, print usage messages on stdout. If a command is invoked with wrong arguments then print the usage messages on stderr. Signed-off-by: Giuseppe Scrivano <gscrivano@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-14parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parseUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-14more tests for git rev-parse --parse-optUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-23Merge branch 'maint'Junio C Hamano
* maint: Extend parse-options test suite api-parse-options.txt: Introduce documentation for parse options API parse-options.c: fix documentation syntax of optional arguments api-builtin.txt: update and fix typo
2008-06-23parse-options.c: fix documentation syntax of optional argumentsMichele Ballabio
When an argument for an option is optional, short options don't need a space between the option and the argument, and long options need a "=". Otherwise, arguments are misinterpreted. Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-14avoid whitespace on empty line in automatic usage messageJeff King
When outputting a usage message with a blank line in the header, we would output a line with four spaces. Make this truly a blank line. This helps us remove trailing whitespace from a test vector. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-24tests: do not use implicit "git diff --no-index"Junio C Hamano
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-26rev-parse: fix potential bus error with --parseopt option spec handlingJay Soffian
A non-empty line containing no spaces should be treated by --parseopt as an option group header, but was causing a bus error. Also added a test script for rev-parse --parseopt. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>