Add documentation for git-branch's color configuration.
Added color.branch and color.branch.<slot> to configuration list. Style copied from color.status and meanings derived from the code. Moved the color meanings from color.diff.<slot> to color.branch.<slot> since the latter comes first alphabetically. Added --color and --no-color to git-branch's usage and documentation. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Brian Gernhardt committed
Jan 3, 2007 at 10:36 UTC
f3673988ecb3d3174f9b6d3d04f00774b1b5c261
3 files changed
+27
-8
Documentation/config.txt
+18
-6
@@ -145,6 +145,21 @@ branch.<name>.merge::
145
this option, `git pull` defaults to merge the first refspec fetched.
146
Specify multiple values to get an octopus merge.
147
148
+color.branch::
149
+ A boolean to enable/disable color in the output of
150
+ gitlink:git-branch[1]. May be set to `true` (or `always`),
151
+ `false` (or `never`) or `auto`, in which case colors are used
152
+ only when the output is to a terminal. Defaults to false.
153
+
154
+color.branch.<slot>::
155
+ Use customized color for branch coloration. `<slot>` is one of
156
+ `current` (the current branch), `local` (a local branch),
157
+ `remote` (a tracking branch in refs/remotes/), `plain` (other
158
+ refs), or `reset` (the normal terminal color). The value for
159
+ these configuration variables can be one of: `normal`, `bold`,
160
+ `dim`, `ul`, `blink`, `reverse`, `reset`, `black`, `red`,
161
+ `green`, `yellow`, `blue`, `magenta`, `cyan`, or `white`.
162
+
163
color.diff::
164
When true (or `always`), always use colors in patch.
165
When false (or `never`), never. When set to `auto`, use
@@ -155,11 +170,8 @@ color.diff.<slot>::
170
specifies which part of the patch to use the specified
171
color, and is one of `plain` (context text), `meta`
172
(metainformation), `frag` (hunk header), `old` (removed
158
- lines), or `new` (added lines). The value for these
159
- configuration variables can be one of: `normal`, `bold`,
160
- `dim`, `ul`, `blink`, `reverse`, `reset`, `black`,
161
- `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, or
162
- `white`.
173
+ lines), or `new` (added lines). The values of these
174
+ variables may be specified as in color.branch.<slot>.
175
176
color.pager::
177
A boolean to enable/disable colored output when the pager is in
@@ -177,7 +189,7 @@ color.status.<slot>::
189
`added` or `updated` (files which are added but not committed),
190
`changed` (files which are changed but not added in the index),
191
or `untracked` (files which are not tracked by git). The values of
180
- these variables may be specified as in color.diff.<slot>.
192
+ these variables may be specified as in color.branch.<slot>.
193
194
diff.renameLimit::
195
The number of files to consider when performing the copy/rename
Documentation/git-branch.txt
+8
-1
@@ -8,7 +8,7 @@ git-branch - List, create, or delete branches.
8
SYNOPSIS
9
--------
10
[verse]
11
-'git-branch' [-r | -a] [-v [--abbrev=<length>]]
11
+'git-branch' [--color | --no-color] [-r | -a] [-v [--abbrev=<length>]]
12
'git-branch' [-l] [-f] <branchname> [<start-point>]
13
'git-branch' (-m | -M) [<oldbranch>] <newbranch>
14
'git-branch' (-d | -D) [-r] <branchname>...
@@ -60,6 +60,13 @@ OPTIONS
60
-M::
61
Move/rename a branch even if the new branchname already exists.
62
63
+--color::
64
+ Color branches to highlight current, local, and remote branches.
65
+
66
+--no-color::
67
+ Turn off branch colors, even when the configuration file gives the
68
+ default to color output.
69
+
70
-r::
71
List or delete (if used with -d) the remote-tracking branches.
72
builtin-branch.c
+1
-1
@@ -12,7 +12,7 @@
12
#include "builtin.h"
13
14
static const char builtin_branch_usage[] =
15
- "git-branch [-r] (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [-r | -a] [-v [--abbrev=<length>]]";
15
+ "git-branch [-r] (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [--color | --no-color] [-r | -a] [-v [--abbrev=<length>]]";
16
17
#define REF_UNKNOWN_TYPE 0x00
18
#define REF_LOCAL_BRANCH 0x01