소스 검색

Merge bare repository support.

Jelmer Vernooij 16 년 전
부모
커밋
617f7e8201
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      git/repository.py

+ 7 - 1
git/repository.py

@@ -33,7 +33,13 @@ class Repository(object):
   ref_locs = ['', 'refs', 'refs/tags', 'refs/heads', 'refs/remotes']
 
   def __init__(self, root):
-    self._basedir = root
+    controldir = os.path.join(root, ".git")
+    if os.path.exists(os.path.join(controldir, "objects")):
+      self.bare = False
+      self._basedir = controldir
+    else:
+      self.bare = True
+      self._basedir = root
 
   def basedir(self):
     return self._basedir