diff options
author | Vincent Driessen <me@nvie.com> | 2016-04-18 11:08:41 +0200 |
---|---|---|
committer | Vincent Driessen <me@nvie.com> | 2016-04-19 21:47:45 +0200 |
commit | a3c89a5e020bb4747fd9470ba9a82a54c33bb5fa (patch) | |
tree | 68399d970b2c3ee32be9178cfb7ecb84c1705ed6 /git/test/test_git.py | |
parent | 8bbf1a3b801fb4e00c10f631faa87114dcd0462f (diff) | |
download | gitpython-a3c89a5e020bb4747fd9470ba9a82a54c33bb5fa.tar.gz |
Support repeated kwargs
Some Git command line options are allowed to be repeated multiple times.
Examples of this are the -C flag which may occur more than once to
"strengthen" its effect, or the -L flag on Git blames, to select
multiple blocks of lines to blame.
$ git diff -C -C HEAD~1 HEAD
$ git blame -L 1-3 -L 12-18 HEAD -- somefile.py
This patch supports passing a list/tuple as the value part for kwargs,
so that the generated Git command contain the repeated options.
Diffstat (limited to 'git/test/test_git.py')
-rw-r--r-- | git/test/test_git.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git/test/test_git.py b/git/test/test_git.py index 3e3e21e4..00592b88 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -70,6 +70,10 @@ class TestGit(TestBase): assert_equal(["--max-count"], self.git.transform_kwargs(**{'max_count': True})) assert_equal(["--max-count=5"], self.git.transform_kwargs(**{'max_count': 5})) + # Multiple args are supported by using lists/tuples + assert_equal(["-L", "1-3", "-L", "12-18"], self.git.transform_kwargs(**{'L': ('1-3', '12-18')})) + assert_equal(["-C", "-C"], self.git.transform_kwargs(**{'C': [True, True]})) + # order is undefined res = self.git.transform_kwargs(**{'s': True, 't': True}) assert ['-s', '-t'] == res or ['-t', '-s'] == res |