You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My env: MacOS 10.12.5, node 8.1.2, npm 5.0.3, grunt-githooks 0.6.0, zsh 5.2.
The same behavior on Windows 7, git version 2.9.0.windows.1.
My Grunt configs (example with pre-commit hook):
eslint...,
githooks: {
viaNode: {
'pre-commit': 'eslint'
},
viaShell: {
options: {
hashbang: '#!/bin/sh',
template: './node_modules/grunt-githooks/templates/shell.hb',
startMarker: '## LET THE FUN BEGIN',
endMarker: '## PARTY IS OVER'
},
'pre-commit': 'eslint'
}
}
Expected behavior
If I use grunt githooks --force then grunt-githooks module should drop existed file .git/hooks/pre-commit aka recreate it with new template.
Actual behavior
Message in CLI is shown, but file in fact is not changed.
Steps to reproduce
run grunt githooks:viaNode it will create default templated pre-commit file.
open .git/hooks/pre-commit file, it's created using Node template.
run grunt githooks:viaShell it will throw warning "A hook already exist for pre-commit but doesn't seem to be written in the same language as the binding script. Use --force to continue."
run grunt githooks:viaShell --force it will throw warning "A hook already exist for pre-commit but doesn't seem to be written in the same language as the binding script. Used --force, continuing."
open .git/hooks/pre-commit file, it's still the same (node-templated).
Delete file .git/hooks/pre-commit
run again grunt githooks:viaShell
and now file .git/hooks/pre-commit created from dedicated Shell-like template.
My version of files:
Node-Template-Based:
#!/usr/bin/env node
// GRUNT-GITHOOKS START
var exec = require('child_process').exec;
exec('grunt eslint', {
cwd: '/Users/alund/prj/builders'
}, function (err, stdout, stderr) {
var exitCode = 0;
if (err) {
console.log(stderr || err);
exitCode = -1;
}
process.exit(exitCode);
}).stdout.on('data', function (chunk){
process.stdout.write(chunk);
});
// GRUNT-GITHOOKS END
Shell-template-based + Gruntfile.config:
#!/bin/sh
## LET THE FUN BEGIN
(cd "/Users/alund/prj/builders" && grunt eslint)
## PARTY IS OVER
Changes to discuss
If such behavior is designed, then IMHO it's odd. What the exactly it continues?
So far, I delete file manually and re-run command. If --force really worked, I could avoid such monkey job :)
My env: MacOS
10.12.5
, node8.1.2
, npm5.0.3
, grunt-githooks0.6.0
, zsh5.2
.The same behavior on Windows 7, git version 2.9.0.windows.1.
My Grunt configs (example with
pre-commit
hook):Expected behavior
If I use
grunt githooks --force
then grunt-githooks module should drop existed file.git/hooks/pre-commit
aka recreate it with new template.Actual behavior
Message in CLI is shown, but file in fact is not changed.
Steps to reproduce
grunt githooks:viaNode
it will create default templated pre-commit file..git/hooks/pre-commit
file, it's created using Node template.grunt githooks:viaShell
it will throw warning "A hook already exist for pre-commit but doesn't seem to be written in the same language as the binding script. Use --force to continue."grunt githooks:viaShell --force
it will throw warning "A hook already exist for pre-commit but doesn't seem to be written in the same language as the binding script. Used --force, continuing.".git/hooks/pre-commit
file, it's still the same (node-templated)..git/hooks/pre-commit
grunt githooks:viaShell
.git/hooks/pre-commit
created from dedicated Shell-like template.My version of files:
Shell-template-based + Gruntfile.config:
Changes to discuss
If such behavior is designed, then IMHO it's odd. What the exactly it continues?
So far, I delete file manually and re-run command. If
--force
really worked, I could avoid such monkey job :)So what people think about it?
cc/ @rhumaric @franz-josef-kaiser
The text was updated successfully, but these errors were encountered: