Closed danhaller closed 9 years ago
Dan, please use proper MarkUp here. Use backticks to format code so it's readable in mails as well. Thanks in advance.
Also could you please show some examples of what you are trying to do before you file a pull request? I don't want you to put any effort (and maybe waste your time) in something that could actually be a XY problem.
You're right, I rushed this issue. I've updated it now, sorry about that.
I'm pretty much trying to implement this as a grunt-githook
Here is what I have:
githooks: {
all: {
'post-merge': {
hashbang: '#!/bin/sh',
template: './node_modules/grunt-githooks/templates/shell.hb',
command: 'changed_files=\"$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" && function run_if_changed() { echo "$changed_files" | grep --quiet "$1" && eval "$2"; } && run_if_changed "client/package.json" "npm install"',
taskNames: "",
startMarker: '## GRUNT GITHOOKS START',
endMarker: '## GRUNT GITHOOKS END'
}
}
}
The command contains quotes and ampersands that get escaped to "
and &
. I could just pull the command into its own file I suppose.
Thanks
In short: You are trying to update your npm
modules whenever you merge a branch? Sidenote: You might want to use npm update
and not npm install
in that case.
Additional info: You can build your own template as well. The provided templates are blueprints anyway.
The shell template includes
{{command}}
which follows handlebars rules and HTML escapes the content e.g. a quote becomes"
This hinders writing some commands using the provided template.
My fix would be to change
{{command}}
to{{{command}}}
which is non-escaping. I can do this with tests tomorrow if that sounds ok.