I have a git pre-commit hook to run the unittest locally on my GNU/Linux manchine. The content of my pre-commit
file is
#!/bin/bash
source activate project && python manage.py test && pylint project
And my .git/config
has
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
hooksPath = /path/to/project/hooks
git commit
runs without problem from the command line.
$ git --version
git version 2.14.1
$ git commit -am "Some message"
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
............................................................................................
----------------------------------------------------------------------
Ran 92 tests in 12.873s
OK
Destroying test database for alias 'default'...
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
[395 c7d2b5c] Some message
1 file changed, 7 insertions(+), 6 deletions(-)
but Magit fails with
1 git … commit --
/path/to/project/hooks/pre-commit: line 3: activate: No such file or directory
I'm using conda as a virtual environment manager and source activate project
is their recommendation.