summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/cmd.py2
-rw-r--r--git/test/test_git.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 3d455546..1481ac81 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -415,7 +415,7 @@ class Git(LazyMixin):
"""
self._persistent_git_options = self.transform_kwargs(
- split_single_char_options=True, **kwargs)
+ split_single_char_options=True, **kwargs)
def _set_cache_(self, attr):
if attr == '_version_info':
diff --git a/git/test/test_git.py b/git/test/test_git.py
index bd8ebee2..ef327c6d 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -160,6 +160,20 @@ class TestGit(TestBase):
git_command_version = self.git.version()
self.assertEquals(git_version, git_command_version)
+ def test_persistent_options(self):
+ git_command_version = self.git.version()
+ # analog to test_options_are_passed_to_git
+ self.git.set_persistent_git_options(version=True)
+ git_version = self.git.NoOp()
+ self.assertEquals(git_version, git_command_version)
+ # subsequent calls keep this option:
+ git_version_2 = self.git.NoOp()
+ self.assertEquals(git_version_2, git_command_version)
+
+ # reset to empty:
+ self.git.set_persistent_git_options()
+ self.assertRaises(GitCommandError, self.git.NoOp)
+
def test_single_char_git_options_are_passed_to_git(self):
input_value = 'TestValue'
output_value = self.git(c='user.name=%s' % input_value).config('--get', 'user.name')