Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error trying to commit using OS X 10.9.2 #2

Open
pkyeck opened this issue Apr 8, 2014 · 5 comments
Open

error trying to commit using OS X 10.9.2 #2

pkyeck opened this issue Apr 8, 2014 · 5 comments

Comments

@pkyeck
Copy link

pkyeck commented Apr 8, 2014

~/www/precommit-example (git::master)*
$ git commit -m "test"
+ SOURCE=.git/hooks/pre-commit
+ '[' -h .git/hooks/pre-commit ']'
+++ dirname .git/hooks/pre-commit
++ cd -P .git/hooks
++ pwd
+ DIR=/Users/phil/www/precommit-example/.git/hooks
++ readlink .git/hooks/pre-commit
+ SOURCE=../../bin/pre-commit
+ [[ ../../bin/pre-commit != /* ]]
+ SOURCE=/Users/phil/www/precommit-example/.git/hooks/../../bin/pre-commit
+ '[' -h /Users/phil/www/precommit-example/.git/hooks/../../bin/pre-commit ']'
+++ dirname /Users/phil/www/precommit-example/.git/hooks/../../bin/pre-commit
++ cd -P /Users/phil/www/precommit-example/.git/hooks/../../bin
++ pwd
+ DIR=/Users/phil/www/precommit-example/bin
+ /Users/phil/www/precommit-example/bin/external npm test
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix

parameters for mktemp seem wrong

@ctavan
Copy link
Contributor

ctavan commented Apr 8, 2014

Are you trying it out on mac? Unfortunately the example won't work with the bsd versions of the core utils. For the example to work on a mac you should install the gnu core utils e.g. using homebrew:

brew install coreutils

Let me know if that works for you.

pkyeck added a commit to pkyeck/precommit-example that referenced this issue Apr 12, 2014
@pkyeck
Copy link
Author

pkyeck commented Apr 12, 2014

OS X comes with a mktemp command but it is slightly different from the BSD version.
I adjusted the script to get it to run on my machine - but because there are no comments I'm not really sure if it still works as expected. I tried with a) a lint error in an unstaged file and b) a lint error in a staged file and the result was as expected.
maybe you could take a quick look at the two changes I made and check if it broke something that my "shallow" tests didn't uncover ;)
thanks.

@pkyeck
Copy link
Author

pkyeck commented Apr 12, 2014

arg ... just checked and the touch -d -t tmp isn't working for ubuntu (BSD version in general I fear). so we'd need to add some more ifs.

@ctavan
Copy link
Contributor

ctavan commented Apr 12, 2014

@pkyeck did you simply try to install the GNU core utils? We also tried to make it work with the BSD or Mac core utils but at some point we just gave up and decided to rely on the GNU core utils...

pkyeck added a commit to pkyeck/precommit-example that referenced this issue Apr 13, 2014
@pkyeck
Copy link
Author

pkyeck commented Apr 13, 2014

did you simply try to install the GNU core utils?

no, I didn't want to add another dependency and just tried it with the built-in tools.
I added some if statements and it should work for OSX and linux now ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants