summaryrefslogtreecommitdiff
path: root/git/__init__.py
diff options
context:
space:
mode:
authorOdegard, Ken <ken.odegard@gmail.com>2017-07-09 19:53:38 +0200
committerOdegard, Ken <ken.odegard@gmail.com>2017-07-09 19:53:38 +0200
commitfeed81ea1a332dc415ea9010c8b5204473a51bdf (patch)
tree9d1ea2b94980bad734a360c8e476e0e871032d42 /git/__init__.py
parenta962464c1504d716d4acee7770d8831cd3a84b48 (diff)
downloadgitpython-feed81ea1a332dc415ea9010c8b5204473a51bdf.tar.gz
Moved setup function into top level __init__
Discovered that the remote module also relies on the git executable as such it also needs to be “refreshed” anytime the git executable is updated or changed. This was best solved by moving the setup function into the top level __init__ where the setup simply calls git.cmd.Git.refresh and git.remote.FetchInfo.refresh.
Diffstat (limited to 'git/__init__.py')
-rw-r--r--git/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/git/__init__.py b/git/__init__.py
index 8c31e309..cc45efe1 100644
--- a/git/__init__.py
+++ b/git/__init__.py
@@ -57,3 +57,20 @@ from git.util import ( # @NoMove @IgnorePep8
__all__ = [name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj))]
+
+#{ Initialize git executable path
+def setup(path=None):
+ """Convenience method for setting the git executable path."""
+ if not Git.refresh(path=path):
+ return
+ if not FetchInfo.refresh():
+ return
+
+def refresh(path=None):
+ """Convenience method for refreshing the git executable path."""
+ setup(path=path)
+#} END initialize git executable path
+
+#################
+setup()
+#################