summaryrefslogtreecommitdiff
path: root/lib/git/repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r--lib/git/repo.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 5853356e..72291dc9 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -12,7 +12,7 @@ from tree import Tree
class Repo(object):
DAEMON_EXPORT_FILE = 'git-daemon-export-ok'
- def __init__(self, path):
+ def __init__(self, path=None):
"""
Create a new Repo instance
@@ -27,19 +27,19 @@ class Repo(object):
Returns
``GitPython.Repo``
"""
- epath = os.path.abspath(path)
+ self.git = Git(path)
+ epath = self.git.get_work_tree()
+ self.path = self.git.get_git_dir()
if os.path.exists(os.path.join(epath, '.git')):
- self.path = os.path.join(epath, '.git')
self.bare = False
- elif os.path.exists(epath) and re.search('\.git$', epath):
- self.path = epath
+ elif os.path.exists(epath) and epath.endswith('.git'):
self.bare = True
elif os.path.exists(epath):
raise InvalidGitRepositoryError(epath)
else:
raise NoSuchPathError(epath)
- self.git = Git(self.path)
+
@property
def description(self):