From 1eae9d1532e037a4eb08aaee79ff3233d2737f31 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 3 Dec 2009 15:52:22 +0100 Subject: repo: fixed incorrect path handling thta could lead to issues if the repository was initialized with a .git repository, although it was not bare actually --- lib/git/repo.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/git/repo.py') diff --git a/lib/git/repo.py b/lib/git/repo.py index aba6cff0..3250230e 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -88,7 +88,7 @@ class Repo(object): while curpath: if is_git_dir(curpath): self.path = curpath - self.wd = curpath + self.wd = os.path.dirname(curpath) break gitpath = os.path.join(curpath, '.git') if is_git_dir(gitpath): @@ -99,6 +99,9 @@ class Repo(object): if not dummy: break # END while curpath + + if self.path is None: + raise InvalidGitRepositoryError(epath) self._bare = False try: @@ -106,9 +109,11 @@ class Repo(object): except Exception: # lets not assume the option exists, although it should pass - - if self.path is None: - raise InvalidGitRepositoryError(epath) + + # adjust the wd in case we are actually bare - we didn't know that + # in the first place + if self._bare: + self.wd = self.path self.git = Git(self.wd) -- cgit v1.2.1