Skip to content

Commit 5b27339

Browse files
FrNecasSebastian Thiel
authored andcommitted
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>
1 parent 859ad04 commit 5b27339

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

git/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ def transform_kwarg(self, name, value, split_single_char_options):
893893
else:
894894
if value is True:
895895
return ["--%s" % dashify(name)]
896-
elif value not in (False, None):
896+
elif value is not False and value is not None:
897897
return ["--%s=%s" % (dashify(name), value)]
898898
return []
899899

git/test/test_git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_it_transforms_kwargs_into_git_command_arguments(self):
8686

8787
assert_equal(["--max-count"], self.git.transform_kwargs(**{'max_count': True}))
8888
assert_equal(["--max-count=5"], self.git.transform_kwargs(**{'max_count': 5}))
89+
assert_equal(["--max-count=0"], self.git.transform_kwargs(**{'max_count': 0}))
8990
assert_equal([], self.git.transform_kwargs(**{'max_count': None}))
9091

9192
# Multiple args are supported by using lists/tuples

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy