From fd5f111439e7a2e730b602a155aa533c68badbf8 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 15 Jun 2008 16:45:29 -0700 Subject: cmd: better support for bare repositories In order to avoid the expense of parsing .git/config just to know whether or not a repository is bare at __init__ time, we just pass an optional flag to Git.__init__(): bare_repo with a default value of False. Repo.init_bare() was updated to pass this flag. We could have an optional Git.read_bare_status() function that does the expensive lookup. Then, users can optionally call it at runtime if they really need to know whether or not a repository is bare. That seems like a decent tradeoff between speed, correctness, and common use cases. Signed-off-by: David Aguilar --- lib/git/repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/git/repo.py') diff --git a/lib/git/repo.py b/lib/git/repo.py index 8b519c1c..5a9855ac 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -280,7 +280,7 @@ class Repo(object): if mkdir and not os.path.exists(path): os.makedirs(path, 0755) - git = Git(path) + git = Git(path, bare_repo=True) output = git.init(**kwargs) return Repo(path) create = init_bare -- cgit v1.2.1