From e0acb8371bb2b68c2bda04db7cb2746ba3f9da86 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 21 Feb 2015 10:12:11 +0100 Subject: Added 'insert_kwargs_after' flag for consumption by _call_process. While at it, all other invocations of .git in remote.py were reviewed Fixes #262 --- git/cmd.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index 7e15d4ea..911bb9f3 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -753,11 +753,23 @@ class Git(LazyMixin): except KeyError: pass + insert_after_this_arg = kwargs.pop('insert_kwargs_after', None) + # Prepare the argument list opt_args = self.transform_kwargs(**kwargs) ext_args = self.__unpack_args([a for a in args if a is not None]) - args = opt_args + ext_args + if insert_after_this_arg is None: + args = opt_args + ext_args + else: + try: + index = ext_args.index(insert_after_this_arg) + except ValueError: + raise ValueError("Couldn't find argument '%s' in args %s to insert kwargs after" + % (insert_after_this_arg, str(ext_args))) + # end handle error + args = ext_args[:index + 1] + opt_args + ext_args[index + 1:] + # end handle kwargs def make_call(): call = [self.GIT_PYTHON_GIT_EXECUTABLE] -- cgit v1.2.1