Skip to content

Commit 8a57176

Browse files
committed
Merge pull request #220 from phase2/feature/flexible-githook-executor
Add config option to specific command runner in git hook scripts.
2 parents a33cc6e + b23fff1 commit 8a57176

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CONFIG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,12 @@ task. This version, specifically invoked by `validate:staged` attempts to
706706
minimize the number of files scanned by checking only those that have changed
707707
since the last successful commit.
708708
709-
#### Configuring Additional Tasks
709+
#### Configuring Git Hooks
710710
711-
**config.git.hooks**: An array of grunt tasks to run on pre-commit.
711+
**config.git.hooks**: An array of grunt tasks to run on pre-commit in addition to `validate:staged`.
712+
713+
**config.git.hook-command**: A substitute for a simple `grunt` command to handle the individual grunt tasks.
714+
Allows specification of more complex bin paths or execution wrappers such as `time` or `docker-compose`.
712715
713716
#### Overriding a Commit Rejection
714717

tasks/git.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ module.exports = function(grunt) {
2525

2626
// Githooks task may be configured via Gruntconfig.
2727
grunt.config('githooks', {
28+
options: {
29+
command: grunt.config('config.git.hook-command') || 'grunt'
30+
},
2831
gdt: {
2932
'pre-commit': _.unique(tasks).join(' ')
3033
}

0 commit comments

Comments
 (0)