瀏覽代碼

Quick fix for git submodules

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Nick Ward 13 年之前
父節點
當前提交
2d559a861f
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      dulwich/repo.py

+ 6 - 0
dulwich/repo.py

@@ -1250,6 +1250,12 @@ class Repo(BaseRepo):
               os.path.isdir(os.path.join(root, REFSDIR))):
             self.bare = True
             self._controldir = root
+        elif (os.path.isfile(os.path.join(root, ".git"))):
+            import re
+            with open(os.path.join(root, ".git"), 'r') as f:
+                _, path = re.match('(gitdir: )(.+$)', f.read()).groups()
+            self.bare = False
+            self._controldir = os.path.join(root, path)
         else:
             raise NotGitRepository(
                 "No git repository was found at %(path)s" % dict(path=root)