kazazor / git-pre-commit

A pre-commit hook that ignores all the unstagged changes while performing the pre-commit command you wrote (Using Shell, Gulp, Grunt etc..)
https://www.npmjs.com/package/git-pre-commit
MIT License
18 stars 5 forks source link

Error when committing in ubuntu #36

Closed mamodom closed 6 years ago

mamodom commented 7 years ago

I'm getting the following error right after installing get-pre-commit

.git/hooks/pre-commit: 9: [: %PATH%: unexpected operator

I found a workaround, which is to change #!/bin/sh to #!/bin/bash in ./.git/hooks/pre-commit line 1.

The only problem is that everyone clonning the repo would have to manually update this, and every time git-pre-commit is re-installed, ./.git/hooks/pre-commit is overwriten

Info

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:    16.10
Codename:   yakkety
kazazor commented 7 years ago

Hi @mamodom , thanks for your feedback!

I'll try to have a look at it soon, I just need to see how it plays on Windows & OSX

wovalle commented 7 years ago

:up: Just happened to me

LjiljanaMatic commented 7 years ago

Is there any progress for this issue? Just got the same error on Ubuntu 16.04 and @mamodom workaround doesn't help me out. Also since I have installed node from package manager tried to define link from nodejs to node with ln -s /usr/bin/nodejs /usr/bin/node and it is not solving my issue. Thanks

michaljurecko commented 7 years ago

Same problem on latest stable Debian.

trevorplant commented 6 years ago

@kazazor It looks like the compare expr needs single = not ==. ie: [ "$TEST" = "%PATH%" ]; This woks on Ubuntu 17.10 and MacOSX 10.13 Sorry I don't have access to a windows env to test on windows.