show-branch: color the commit status signs
PATCH 1/1 show-branch: color the commit status signs
Make it possible to color the status character ('*' '!' '+' '-') of commits. Each branch uses a single color. This makes it easier to follow a particular branch, especially when there are gaps in the output.
Add the config option color.showbranch and the command line options
--color and --no-color to control the colored output.
---
I will send a patch for bash completion of --[no-]color and color.showbranch, when this patch is accepted.
Documentation/config.txt | 6 ++++ Documentation/git-show-branch.txt | 8 ++++++ builtin-show-branch.c | 51 ++++++++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 4 deletions(-)
Documentation/config.txt +6 -0
@@ -595,6 +595,12 @@ color.pager:: A boolean to enable/disable colored output when the pager is in use (default is true). +color.showbranch:: + A boolean to enable/disable color in the output of + linkgit:git-show-branch[1]. May be set to `always`, + `false` (or `never`) or `auto` (or `true`), in which case colors are used + only when the output is to a terminal. Defaults to false. + color.status:: A boolean to enable/disable color in the output of linkgit:git-status[1]. May be set to `always`,
Documentation/git-show-branch.txt +8 -0
@@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git show-branch' [--all] [--remotes] [--topo-order] [--current] [--more=<n> | --list | --independent | --merge-base] + [--color | --no-color] [--no-name | --sha1-name] [--topics] [<rev> | <glob>]... 'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
@@ -107,6 +108,13 @@ OPTIONS When no explicit <ref> parameter is given, it defaults to the current branch (or `HEAD` if it is detached). +--color:: + Color the status sign of the commits. Each branch uses a single color. + +--no-color:: + Turn off colored output, even when the configuration file gives the + default to color output. + Note that --more, --list, --independent and --merge-base options are mutually exclusive.
builtin-show-branch.c +47 -4
99 lines not on this page · raw message
Signature · 1 line
1.6.3.rc1.61.ge6ab3
Quoted 2 lines · Markus Heidelberg
+--color::
+ Color the status sign of the commits. Each branch uses a single color.
I don't know what the status sign of a commit is without reading your commit message. Maybe reword this to be:
Color the status sign ('*' '!' '+' '-') of each commit corresponding to the branch
it's in.
builtin-show-branch.c line 22
Quoted 10 lines
builtin-show-branch.c +10
-0+static char column_colors[][COLOR_MAXLEN ] = { + GIT_COLOR_RED, + GIT_COLOR_GREEN, + GIT_COLOR_YELLOW, + GIT_COLOR_BLUE, + GIT_COLOR_MAGENTA, + GIT_COLOR_CYAN, +}; + +#define COLUMN_COLORS_MAX (ARRAY_SIZE(column_colors))
This looks like a copy/paste (with a small edit) from graph.c so maybe you want to refactor the original code from graph.c to color.h?
Stephen Boyd, 22.04.2009:
Quoted 10 lines · Markus Heidelberg
Quoted 2 lines
+--color::
+ Color the status sign of the commits. Each branch uses a single color.I don't know what the status sign of a commit is without reading your commit message. Maybe reword this to be:
Color the status sign ('*' '!' '+' '-') of each commit corresponding to the branch
it's in.
I had some problems with finding the right words for the description and still wasn't satisfied with it. I think your suggestion makes it easier and will include it.
Quoted 5 lines
Quoted 5 lines
+static char column_colors[][COLOR_MAXLEN] = {
+GIT_COLOR_RED,
+GIT_COLOR_GREEN,
+GIT_COLOR_YELLOW,
+GIT_COLOR_BLUE,
Quoted 8 lines
builtin-show-branch.c line 22
Quoted 5 lines
+
GIT_COLOR_MAGENTA,
+GIT_COLOR_CYAN,builtin-show-branch.c +3
-0+}; + +#define COLUMN_COLORS_MAX (ARRAY_SIZE(column_colors))This looks like a copy/paste (with a small edit) from
graph.cso maybe you want to refactor the original code fromgraph.ctocolor.h?
How exactly do you think it can be refactored and then combined?
Markus
Quoted 30 lines · Markus Heidelberg
Stephen Boyd, 22.04.2009:
Quoted 10 lines · Markus Heidelberg
Quoted 2 lines
+--color::
+ Color the status sign of the commits. Each branch uses a single color.I don't know what the status sign of a commit is without reading your commit message. Maybe reword this to be:
Color the status sign ('*' '!' '+' '-') of each commit corresponding to the branch
it's in.I had some problems with finding the right words for the description and still wasn't satisfied with it. I think your suggestion makes it easier and will include it.
Quoted 5 lines
Quoted 5 lines
+static char column_colors[][COLOR_MAXLEN] = {
+GIT_COLOR_RED,
+GIT_COLOR_GREEN,
+GIT_COLOR_YELLOW,
+GIT_COLOR_BLUE,Quoted 8 lines
builtin-show-branch.c line 22
Quoted 5 lines
+
GIT_COLOR_MAGENTA,
+GIT_COLOR_CYAN,builtin-show-branch.c +3
-0+}; + +#define COLUMN_COLORS_MAX (ARRAY_SIZE(column_colors))This looks like a copy/paste (with a small edit) from
graph.cso maybe you want to refactor the original code fromgraph.ctocolor.h?
Quoted 1 line
How exactly do you think it can be refactored and then combined?
These tables belong to each command. Your show-branches do not necessarily want to get different set or number of colors when graph output updates its color palette to have richer set of colors. I do not see any need for "refactoring" here.
PATCH v2 1/1 show-branch: color the commit status signs
Make it possible to color the status character ('*' '!' '+' '-') of each commit corresponding to the branch it's in. This makes it easier to follow a particular branch, especially if there are larger gaps in the output.
Add the config option color.showbranch and the command line options
--color and --no-color to control the colored output.
---
Clarify the --color description based on the suggestion from Stephen Boyd.
Documentation/config.txt | 6 ++++ Documentation/git-show-branch.txt | 9 ++++++ builtin-show-branch.c | 51 ++++++++++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 4 deletions(-)
Documentation/config.txt +6 -0
@@ -595,6 +595,12 @@ color.pager:: A boolean to enable/disable colored output when the pager is in use (default is true). +color.showbranch:: + A boolean to enable/disable color in the output of + linkgit:git-show-branch[1]. May be set to `always`, + `false` (or `never`) or `auto` (or `true`), in which case colors are used + only when the output is to a terminal. Defaults to false. + color.status:: A boolean to enable/disable color in the output of linkgit:git-status[1]. May be set to `always`,
Documentation/git-show-branch.txt +9 -0
@@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git show-branch' [--all] [--remotes] [--topo-order] [--current] [--more=<n> | --list | --independent | --merge-base] + [--color | --no-color] [--no-name | --sha1-name] [--topics] [<rev> | <glob>]... 'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
@@ -107,6 +108,14 @@ OPTIONS When no explicit <ref> parameter is given, it defaults to the current branch (or `HEAD` if it is detached). +--color:: + Color the status sign (one of these: `*` `!` `+` `-`) of each commit + corresponding to the branch it's in. + +--no-color:: + Turn off colored output, even when the configuration file gives the + default to color output. + Note that --more, --list, --independent and --merge-base options are mutually exclusive.
builtin-show-branch.c +47 -4
99 lines not on this page · raw message
Signature · 1 line
1.6.3.rc1.61.ge6ab3