summaryrefslogtreecommitdiff
path: root/lib/git/repo.py
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2008-06-15 16:45:29 -0700
committerDavid Aguilar <davvid@gmail.com>2008-06-15 16:45:29 -0700
commitfd5f111439e7a2e730b602a155aa533c68badbf8 (patch)
treea9d2ae2b7b1fcc63fa75dac8d9134f749940e8de /lib/git/repo.py
parentabc2e538c6f2fe50f93e6c3fe927236bb41f94f4 (diff)
downloadgitpython-fd5f111439e7a2e730b602a155aa533c68badbf8.tar.gz
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 <davvid@gmail.com>
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r--lib/git/repo.py2
1 files changed, 1 insertions, 1 deletions
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