From 5b27339b0d7da97743256e871757d54bf5159bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Ne=C4=8Das?= Date: Tue, 23 Jul 2019 12:43:24 +0200 Subject: Fix Git.transform_kwarg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kwargs were not transformed correctly if a value was set to 0 due to wrong if condition. Signed-off-by: František Nečas --- git/cmd.py | 2 +- git/test/test_git.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/git/cmd.py b/git/cmd.py index 64c3d480..50b1e321 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -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 -- cgit v1.2.1