1

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.

1 Answer 1

1

Following this advice by Jonas Bernoulli solved my problem: install https://github.com/purcell/exec-path-from-shell and follow the instructions on what to put in ~/.emacs (or, preferably, ~/.emacs.d/init.el).

3
  • 1
    Could you please edit your question to confirm that you're on Mac OS?
    – Dan
    Commented Oct 9, 2017 at 10:16
  • @Dan I'm using GNU/Linux. I edit it. Commented Oct 9, 2017 at 14:11
  • You can accept your own answer. (Though generally it is a good idea to delay doing so for a little while, not to discourage other answers.)
    – tarsius
    Commented Oct 30, 2017 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.