Signed-off-by: Pierre Habouzit <redacted>
---
While we're at it, this one could probably be squashed on top of the
previous one.
Documentation/git-rev-parse.txt | 8 +++++---
builtin-rev-parse.c | 5 ++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index e961c20..6513c2e 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -325,7 +325,7 @@ The lines after the separator describe the options.
Each line of options has this format:
------------
-<opt_spec><flags>? SP+ help LF
+<opt_spec><flags>* SP+ help LF
------------
`<opt_spec>`::
@@ -335,8 +335,8 @@ Each line of options has this format:
`<opt_spec>`.
`<flags>`::
- `<flags>` are any suite of `*`, `=` or `?`.
- * Use `=` if the option take an argument.
+ `<flags>` are of `*`, `=`, `?` or `!`.
+ * Use `=` if the option takes an argument.
* Use `?` to mean that the option is optional (though its use is discouraged).
@@ -344,6 +344,8 @@ Each line of options has this format:
generated for the `-h` argument. It's shown for `--help-all` as
documented in linkgit:gitcli[5].
+ * Use `!` to not make the corresponding negated long option available.
+
The remainder of the line, after stripping the spaces, is used
as the help associated to the option.
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index d1ea73a..0351d54 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -324,7 +324,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
o->value = &parsed;
o->flags = PARSE_OPT_NOARG;
o->callback = &parseopt_dump;
- while (s > sb.buf && strchr("*=?", s[-1])) {
+ while (s > sb.buf && strchr("*=?!", s[-1])) {
switch (*--s) {
case '=':
o->flags &= ~PARSE_OPT_NOARG;@@ -333,6 +333,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
o->flags &= ~PARSE_OPT_NOARG;
o->flags |= PARSE_OPT_OPTARG;
break;
+ case '!':
+ o->flags |= PARSE_OPT_NONEG;
+ break;
case '*':
o->flags |= PARSE_OPT_HIDDEN;
break;
--
1.5.4.3.471.ga96e8.dirty