diff options
author | Mark Lodato <lodatom@gmail.com> | 2010-02-16 23:55:58 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-18 17:21:40 -0800 |
commit | 73e9da019655261e456ed862340880de365111f0 (patch) | |
tree | 3668881735169164f975f4db0983241cf3d631ba /Documentation/git-branch.txt | |
parent | e923eaeb901ff056421b9007adcbbce271caa7b6 (diff) | |
download | git-73e9da019655261e456ed862340880de365111f0.tar.gz |
Add an optional argument for --color options
Make git-branch, git-show-branch, git-grep, and all the diff-based
programs accept an optional argument <when> for --color. The argument
is a colorbool: "always", "never", or "auto". If no argument is given,
"always" is used; --no-color is an alias for --color=never. This makes
the command-line interface consistent with other GNU tools, such as `ls'
and `grep', and with the git-config color options. Note that, without
an argument, --color and --no-color work exactly as before.
To implement this, two internal changes were made:
1. Allow the first argument of git_config_colorbool() to be NULL,
in which case it returns -1 if the argument isn't "always", "never",
or "auto".
2. Add OPT_COLOR_FLAG(), OPT__COLOR(), and parse_opt_color_flag_cb()
to the option parsing library. The callback uses
git_config_colorbool(), so color.h is now a dependency
of parse-options.c.
Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-branch.txt')
-rw-r--r-- | Documentation/git-branch.txt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 6b6c3da2d9..903a690f10 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -8,7 +8,7 @@ git-branch - List, create, or delete branches SYNOPSIS -------- [verse] -'git branch' [--color | --no-color] [-r | -a] +'git branch' [--color[=<when>] | --no-color] [-r | -a] [-v [--abbrev=<length> | --no-abbrev]] [(--merged | --no-merged | --contains) [<commit>]] 'git branch' [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>] @@ -84,12 +84,14 @@ OPTIONS -M:: Move/rename a branch even if the new branch name already exists. ---color:: +--color[=<when>]:: Color branches to highlight current, local, and remote branches. + The value must be always (the default), never, or auto. --no-color:: Turn off branch colors, even when the configuration file gives the default to color output. + Same as `--color=never`. -r:: List or delete (if used with -d) the remote-tracking branches. |