aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-20 12:05:26 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-20 12:53:59 +0100
commit6d2853a0637725c2d9e98112167d0fbe32b94900 (patch)
treea162e160477ab0eaba80ca6ad743055386b70119
parentf9a7640388137018f195e2ba43c8115548342c7c (diff)
Allow to pass config args to git
-rw-r--r--gbp/git/repository.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 25d2bca..654ec0b 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -142,7 +142,7 @@ class GitRepository(object):
return output, popen.returncode
def _git_inout(self, command, args, input=None, extra_env=None, cwd=None,
- capture_stderr=False):
+ capture_stderr=False, config_args=None):
"""
Run a git command with input and return output
@@ -161,14 +161,19 @@ class GitRepository(object):
"""
if not cwd:
cwd = self.path
- return self.__git_inout(command, args, input, extra_env, cwd, capture_stderr)
+ return self.__git_inout(command, args, input, extra_env, cwd, capture_stderr, config_args)
@classmethod
- def __git_inout(cls, command, args, input, extra_env, cwd, capture_stderr):
+ def __git_inout(cls, command, args, input, extra_env, cwd, capture_stderr, config_args=None):
"""
As _git_inout but can be used without an instance
"""
- cmd = ['git', command] + args
+ config_opts = []
+ config_args = config_args or []
+ for arg in config_args:
+ config_opts.extend(['-c', arg])
+
+ cmd = ['git'] + config_opts + [command] + args
env = cls.__build_env(extra_env)
stderr_arg = subprocess.PIPE if capture_stderr else None
stdin_arg = subprocess.PIPE if input is not None else None