diff options
author | Brandon Casey <drafnel@gmail.com> | 2017-09-17 15:28:14 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-19 12:13:05 +0900 |
commit | f221861e490d2c57b960cf86c5bc37279a3ebc2b (patch) | |
tree | 9a296db290a7af56678c07690029603c874ddfd2 /COPYING | |
parent | RelNotes: further fixes for 2.14.2 from the master front (diff) | |
download | tgif-f221861e490d2c57b960cf86c5bc37279a3ebc2b.tar.xz |
t1502: demonstrate rev-parse --parseopt option mis-parsing
Since commit 2d893df rev-parse will scan forward from the beginning of
the option string looking for a flag character. If there are no flag
characters then the scan will spill over into the help text and will
interpret the characters preceding the "flag" as part of the option-spec
i.e. the long option name.
For example, the following option spec:
exclame this does something!
will produce this 'set' expression when --exclame is specified:
set -- --exclame this does something --
which will be interpreted as four separate parameters by the shell. And
will produce a help string that looks like:
--exclame this does something
this does something!
git-rebase.sh has such an option (--autosquash), and so will add extra
parameters to the 'set' expression when --autosquash is used.
git-rebase continues to work correctly though because when it parses the
arguments, it ignores ones that it does not recognize.
Also, rev-parse --parseopt does not currently interpret a tab character
as a delimiter between the option spec and the help text. If a tab is
used at the end of the option spec, before the help text, and before a
space has been specified, then rev-parse will interpret the tab as part
of the preceding component (either the long name or the arg hint).
For example, the following option spec (note: there is a <tab> between
"frotz" and "enable"):
frotz enable frotzing
will produce this 'set' expression when --frotz is specified:
set -- --frotz enable --
which will be interpreted as 2 separate arguments by the shell.
git-rebase.sh has one of these too (--keep-empty). In this case the tab
is immediately followed by spaces so there are no additional parameters
produced on the command line. The only side-effect is misalignment in
the help text.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions