summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
Diffstat (limited to 'git')
-rw-r--r--git/__init__.py9
-rw-r--r--git/test/test_git.py9
2 files changed, 12 insertions, 6 deletions
diff --git a/git/__init__.py b/git/__init__.py
index cc45efe1..7005cd60 100644
--- a/git/__init__.py
+++ b/git/__init__.py
@@ -58,19 +58,16 @@ 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):
+def refresh(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()
+refresh()
#################
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 3c8b6f82..00577e33 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -10,6 +10,7 @@ import sys
from git import (
Git,
+ refresh,
GitCommandError,
GitCommandNotFound,
Repo,
@@ -156,6 +157,14 @@ class TestGit(TestBase):
type(self.git).GIT_PYTHON_GIT_EXECUTABLE = prev_cmd
# END undo adjustment
+ def test_refresh(self):
+ # test a bad git path refresh
+ self.assertRaises(GitCommandNotFound, refresh, "yada")
+
+ # test a good path refresh
+ path = os.popen("which git").read().strip()
+ refresh(path)
+
def test_options_are_passed_to_git(self):
# This work because any command after git --version is ignored
git_version = self.git(version=True).NoOp()