diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-19 16:16:24 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-19 17:02:35 +0200 |
commit | 76ac61a2b4bb10c8434a7d6fc798b115b4b7934d (patch) | |
tree | 763993b8d2c46a425db36e12d941db79866f7de7 /git/cmd.py | |
parent | cc77e6b2862733a211c55cf29cc7a83c36c27919 (diff) | |
parent | 9d5d143f72e4d588e3a0abb2ab82fa5a2c35e8aa (diff) | |
download | gitpython-76ac61a2b4bb10c8434a7d6fc798b115b4b7934d.tar.gz |
Merge with latest branch 'exp_git_dir'
Conflicts:
git/repo/base.py
git/repo/fun.py
git/test/test_submodule.py
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -162,7 +162,7 @@ class Git(LazyMixin): Set its value to 'full' to see details about the returned values. """ __slots__ = ("_working_dir", "cat_file_all", "cat_file_header", "_version_info", - "_git_options", "_environment") + "_git_options", "_persistent_git_options", "_environment") _excluded_ = ('cat_file_all', 'cat_file_header', '_version_info') @@ -405,6 +405,7 @@ class Git(LazyMixin): super(Git, self).__init__() self._working_dir = working_dir self._git_options = () + self._persistent_git_options = [] # Extra environment variables to pass to git commands self._environment = {} @@ -421,6 +422,20 @@ class Git(LazyMixin): return LazyMixin.__getattr__(self, name) return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) + def set_persistent_git_options(self, **kwargs): + """Specify command line options to the git executable + for subsequent subcommand calls + + :param kwargs: + is a dict of keyword arguments. + these arguments are passed as in _call_process + but will be passed to the git command rather than + the subcommand. + """ + + self._persistent_git_options = self.transform_kwargs( + split_single_char_options=True, **kwargs) + def _set_cache_(self, attr): if attr == '_version_info': # We only use the first 4 numbers, as everthing else could be strings in fact (on windows) @@ -839,7 +854,10 @@ class Git(LazyMixin): call = [self.GIT_PYTHON_GIT_EXECUTABLE] - # add the git options, the reset to empty + # add persistent git options + call.extend(self._persistent_git_options) + + # add the git options, then reset to empty # to avoid side_effects call.extend(self._git_options) self._git_options = () |