diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-10-22 16:30:17 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-10-23 16:20:33 +0200 |
commit | 642db87a79ef5e9b5b8f4b20d63bf5e7141d48b2 (patch) | |
tree | d4c0de65effbc1779e4c807583257525cea40724 | |
parent | 9f168491bc9240919ffd48ca5450dc8b45137dc3 (diff) |
GitRepository.__init__: use more robust "git rev-parse --show-cdup"
instead of just looking for a ".git" directory
-rw-r--r-- | gbp/git.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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""" |