diff options
author | František Nečas <fifinecas@seznam.cz> | 2019-07-23 12:43:24 +0200 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-08-14 18:05:33 +0800 |
commit | 5b27339b0d7da97743256e871757d54bf5159bca (patch) | |
tree | 7b3329c8d3974c335792388d1779a252cc838c4f | |
parent | 859ad046aecc077b9118f0a1c2896e3f9237cd75 (diff) | |
download | gitpython-5b27339b0d7da97743256e871757d54bf5159bca.tar.gz |
Fix Git.transform_kwarg
Kwargs were not transformed correctly if a value was set to 0 due to
wrong if condition.
Signed-off-by: František Nečas <fifinecas@seznam.cz>
-rw-r--r-- | git/cmd.py | 2 | ||||
-rw-r--r-- | git/test/test_git.py | 1 |
2 files changed, 2 insertions, 1 deletions
@@ -893,7 +893,7 @@ class Git(LazyMixin): else: if value is True: return ["--%s" % dashify(name)] - elif value not in (False, None): + elif value is not False and value is not None: return ["--%s=%s" % (dashify(name), value)] return [] diff --git a/git/test/test_git.py b/git/test/test_git.py index 30a6a335..4a189267 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -86,6 +86,7 @@ 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})) + assert_equal(["--max-count=0"], self.git.transform_kwargs(**{'max_count': 0})) assert_equal([], self.git.transform_kwargs(**{'max_count': None})) # Multiple args are supported by using lists/tuples |