summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-22 16:30:17 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-23 16:20:33 +0200
commit642db87a79ef5e9b5b8f4b20d63bf5e7141d48b2 (patch)
treed4c0de65effbc1779e4c807583257525cea40724
parent9f168491bc9240919ffd48ca5450dc8b45137dc3 (diff)
GitRepository.__init__: use more robust "git rev-parse --show-cdup"
instead of just looking for a ".git" directory
-rw-r--r--gbp/git.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 23cbb3f..6a3ff6f 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -89,12 +89,13 @@ class GitRepository(object):
"""
def __init__(self, path):
+ self.path = os.path.abspath(path)
try:
- os.stat(os.path.join(path,'.git'))
+ out, ret = self.__git_getoutput('rev-parse', ['--show-cdup'])
+ if ret or out != ['\n']:
+ raise GitRepositoryError("No git repo at '%s'" % path)
except:
raise GitRepositoryError("No git repo at '%s'" % path)
- self.path = os.path.abspath(path)
-
def __build_env(self, extra_env):
"""Prepare environment for subprocess calls"""