summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorEric Brunson <ebrunson@quicinc.com>2014-04-23 11:13:54 -0600
committerEric Brunson <ebrunson@quicinc.com>2014-04-25 09:32:17 -0600
commitf2df73b317a4e2834037be8b67084bee0b533bfe (patch)
treeb49ae55ae8c398aef561280ab18a3db36773d219 /git/cmd.py
parente54cd8fed2d1788618df64b319a30c7aed791191 (diff)
downloadgitpython-f2df73b317a4e2834037be8b67084bee0b533bfe.tar.gz
add git command options
Add __call__ method to Git object to allow passing git command options to the executable requires flag to transform_kwargs add unit test Change-Id: If1bc01008e66d3fd3811c15b56e58f38c95b9887
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/git/cmd.py b/git/cmd.py
index e57bb761..b3274dd8 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -388,7 +388,7 @@ class Git(LazyMixin):
else:
return stdout_value
- def transform_kwargs(self, **kwargs):
+ def transform_kwargs(self, split_single_char_options=False, **kwargs):
"""Transforms Python style kwargs into git command line options."""
args = list()
for k, v in kwargs.items():
@@ -396,7 +396,10 @@ class Git(LazyMixin):
if v is True:
args.append("-%s" % k)
elif type(v) is not bool:
- args.append("-%s%s" % (k, v))
+ if split_single_char_options:
+ args.extend(["-%s" % k, "%s" % v])
+ else:
+ args.append("-%s%s" % (k, v))
else:
if v is True:
args.append("--%s" % dashify(k))
@@ -431,7 +434,8 @@ class Git(LazyMixin):
``Examples``::
git(work_tree='/tmp').difftool()"""
- self._git_options = self.transform_kwargs(**kwargs)
+ self._git_options = self.transform_kwargs(
+ split_single_char_options=True, **kwargs)
return self
def _call_process(self, method, *args, **kwargs):