From e17c746d66e6a66019df964f533a01fe984f0c60 Mon Sep 17 00:00:00 2001 From: Thierry Deo Date: Thu, 12 Nov 2015 16:59:52 +0100 Subject: [PATCH] Get hook path method for submodule --- pre_commit/runner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pre_commit/runner.py b/pre_commit/runner.py index ae720d05..bedf16ed 100644 --- a/pre_commit/runner.py +++ b/pre_commit/runner.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import os import os.path +import subprocess from cached_property import cached_property @@ -44,7 +45,9 @@ class Runner(object): return repositories def get_hook_path(self, hook_type): - return os.path.join(self.git_root, '.git', 'hooks', hook_type) + git_dir = subprocess.check_output('git rev-parse --git-dir', + shell=True) + return os.path.join(git_dir.strip(), 'hooks', hook_type) @cached_property def pre_commit_path(self):