Skip to content

Commit 1200e2f

Browse files
authored
Merge pull request #3 from tommarshall/add-support-for-color-override
Add support for color override
2 parents f000e67 + f90fab1 commit 1200e2f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Offers an interactive prompt if any of the rules are detected to be broken.
2727
At the root of the repository, run:
2828

2929
```sh
30-
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.2.0/hook.sh > .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
30+
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.3.0/hook.sh > .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
3131
```
3232

3333
### Globally
@@ -37,14 +37,14 @@ To use the hook globally, you can use `git-init`'s template directory:
3737
```sh
3838
mkdir -p ~/.git-template/hooks
3939
git config --global init.templatedir '~/.git-template'
40-
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.2.0/hook.sh > ~/.git-template/hooks/commit-msg && chmod +x ~/.git-template/hooks/commit-msg
40+
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.3.0/hook.sh > ~/.git-template/hooks/commit-msg && chmod +x ~/.git-template/hooks/commit-msg
4141
```
4242

4343
The hook will now be present after any `git init` or `git clone`. You can [safely re-run `git init`](http://stackoverflow.com/a/5149861/885540) on any existing repositories to add the hook there.
4444

4545
---
4646

47-
_If you're security conscious, you may be reasonably suspicious of [curling executable files](https://www.seancassidy.me/dont-pipe-to-your-shell.html). In this case you're on HTTPS throughout, and not piping directly to execution, so you can check contents and the hash against MD5 `5addd4052346aac69dec3faad4b46261` for v0.2.0._
47+
_If you're security conscious, you may be reasonably suspicious of [curling executable files](https://www.seancassidy.me/dont-pipe-to-your-shell.html). In this case you're on HTTPS throughout, and not piping directly to execution, so you can check contents and the hash against MD5 `23a607325827a12482bb95a208c4a5ee` for v0.3.0._
4848

4949
## Usage
5050

@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# git-good-commit(1) - Git hook to help you write good commit messages.
55
# Released under the MIT License.
66
#
7-
# Version 0.2.0
7+
# Version 0.3.0
88
#
99
# https://github.com/tommarshall/git-good-commit
1010
#
@@ -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)