Skip to content

Commit 4bad625

Browse files
committed
Use hooks.goodcommit.color for color config if set
This change: * Favour `hooks.goodcommit.color` for color config if set, fallback to `color.ui` if not set, default to `auto` if none set. * Adds 'Configuration' section to README.
1 parent f000e67 commit 4bad625

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ n - abort commit
6565
? - print help
6666
```
6767

68+
## Configuration
69+
70+
The default colour setting is `auto`, but the hook will use `git`'s `color.ui` config setting if defined. You override the colour setting for the hook with:
71+
72+
```
73+
git config --global hooks.goodcommit.color "never"
74+
```
75+
76+
Supported values are `always`, `auto`, `never` and `false`.
77+
6878
## Dependencies
6979

7080
None, other than Bash.

hook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NC=
2525
#
2626

2727
set_colors() {
28-
local default_color=$(git config --get color.ui || echo 'auto')
28+
local default_color=$(git config --get hooks.goodcommit.color || git config --get color.ui || echo 'auto')
2929
if [[ $default_color == 'always' ]] || [[ $default_color == 'auto' && -t 1 ]]; then
3030
RED='\033[1;31m'
3131
YELLOW='\033[1;33m'

0 commit comments

Comments
 (0)