Update draft release notes to 2.0
[gitweb.git] / Documentation / git-rev-parse.txt
index d068a653778d6713d6ab370379dadf0d6f754856..e05e6b35939326caa5fa2658d875b0d099216d9f 100644 (file)
@@ -50,6 +50,10 @@ Options for --parseopt
        the first non-option argument.  This can be used to parse sub-commands
        that take options themselves.
 
+--stuck-long::
+       Only meaningful in `--parseopt` mode. Output the options in their
+       long form if available, and with their arguments stuck.
+
 Options for Filtering
 ~~~~~~~~~~~~~~~~~~~~~
 
@@ -173,6 +177,20 @@ shown.  If the pattern does not contain a globbing character (`?`,
        character (`?`, `*`, or `[`), it is turned into a prefix
        match by appending `/*`.
 
+--exclude=<glob-pattern>::
+       Do not include refs matching '<glob-pattern>' that the next `--all`,
+       `--branches`, `--tags`, `--remotes`, or `--glob` would otherwise
+       consider. Repetitions of this option accumulate exclusion patterns
+       up to the next `--all`, `--branches`, `--tags`, `--remotes`, or
+       `--glob` option (other options or arguments do not clear
+       accumlated patterns).
++
+The patterns given should not begin with `refs/heads`, `refs/tags`, or
+`refs/remotes` when applied to `--branches`, `--tags`, or `--remotes`,
+respectively, and they must begin with `refs/` when applied to `--glob`
+or `--all`. If a trailing '/{asterisk}' is intended, it must be given
+explicitly.
+
 --disambiguate=<prefix>::
        Show every object whose name begins with the given prefix.
        The <prefix> must be at least 4 hexadecimal digits long to
@@ -266,13 +284,13 @@ Input Format
 
 'git rev-parse --parseopt' input format is fully text based. It has two parts,
 separated by a line that contains only `--`. The lines before the separator
-(should be more than one) are used for the usage.
+(should be one or more) are used for the usage.
 The lines after the separator describe the options.
 
 Each line of options has this format:
 
 ------------
-<opt_spec><flags>* SP+ help LF
+<opt_spec><flags>*<arg_hint>? SP+ help LF
 ------------
 
 `<opt_spec>`::
@@ -285,7 +303,9 @@ Each line of options has this format:
        `<flags>` are of `*`, `=`, `?` or `!`.
        * Use `=` if the option takes an argument.
 
-       * Use `?` to mean that the option is optional (though its use is discouraged).
+       * Use `?` to mean that the option takes an optional argument. You
+         probably want to use the `--stuck-long` mode to be able to
+         unambiguously parse the optional argument.
 
        * Use `*` to mean that this option should not be listed in the usage
          generated for the `-h` argument. It's shown for `--help-all` as
@@ -293,6 +313,12 @@ Each line of options has this format:
 
        * Use `!` to not make the corresponding negated long option available.
 
+`<arg_hint>`::
+       `<arg_hint>`, if specified, is used as a name of the argument in the
+       help output, for options that take arguments. `<arg_hint>` is
+       terminated by the first whitespace. When you need to use space in the
+       argument hint use dash instead.
+
 The remainder of the line, after stripping the spaces, is used
 as the help associated to the option.
 
@@ -313,6 +339,8 @@ h,help    show the help
 
 foo       some nifty option --foo
 bar=      some cool option --bar with an argument
+baz=arg   another cool option --baz with a named argument
+qux?path  qux may take a path argument but has meaning by itself
 
   An option group Header
 C?        option C with an optional argument"
@@ -320,6 +348,28 @@ C?        option C with an optional argument"
 eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
 ------------
 
+
+Usage text
+~~~~~~~~~~
+
+When `"$@"` is `-h` or `--help` in the above example, the following
+usage text would be shown:
+
+------------
+usage: some-command [options] <args>...
+
+    some-command does foo and bar!
+
+    -h, --help            show the help
+    --foo                 some nifty option --foo
+    --bar ...             some cool option --bar with an argument
+    --bar <arg>           another cool option --baz with a named argument
+    --qux[=<path>]        qux may take a path argument but has meaning by itself
+
+An option group Header
+    -C[...]               option C with an optional argument
+------------
+
 SQ-QUOTE
 --------