rev-parse --parseopt: allow [*=?!] in argument hints
commit2d893dff4c3c49750557da7a1701b46c1fe95844
authorIlya Bobyr <ilya.bobyr@gmail.com>
Tue, 14 Jul 2015 08:17:44 +0000 (14 01:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2015 17:30:54 +0000 (15 10:30 -0700)
treec31c50bce40469019197d39e3c7d8f0a08ab04a2
parent7ecec52d42a964c4a8e9f6ca41bb0b5ce00049b4
rev-parse --parseopt: allow [*=?!] in argument hints

A line in the input to "rev-parse --parseopt" describes an option by
listing a short and/or long name, optional flags [*=?!], argument hint,
and then whitespace and help string.

We did not allow any of the [*=?!] characters in the argument hints.
The following input

    pair=key=value  equals sign in the hint

used to generate a help line like this:

    --pair=key <value>   equals sign in the hint

and used to expect "pair=key" as the argument name.

That is not very helpful as we generally do not want any of the [*=?!]
characters in the argument names.  But we do want to use at least the
equals sign in the argument hints.

Update the parser to make long argument names stop at the first [*=?!]
character.

Add test case with equals sign in the argument hint and update the test
to perform all the operations in test_expect_success matching the
t/README requirements and allowing commands like

    ./t1502-rev-parse-parseopt.sh --run=1-2

to stop at the test case 2 without any further modification of the test
state area.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-rev-parse.txt
builtin/rev-parse.c
t/t1502-rev-parse-parseopt.sh