Commit cb1dafdf authored by Lars Schneider's avatar Lars Schneider Committed by Junio C Hamano

git-p4: add gitConfigInt reader

Add a git config reader for integer variables. Please note that the
git config implementation automatically supports k, m, and g suffixes.
Signed-off-by: default avatarLars Schneider <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 692e1796
......@@ -623,6 +623,17 @@ def gitConfigBool(key):
_gitConfig[key] = gitConfig(key, '--bool') == "true"
return _gitConfig[key]
def gitConfigInt(key):
if not _gitConfig.has_key(key):
cmd = [ "git", "config", "--int", key ]
s = read_pipe(cmd, ignore_error=True)
v = s.strip()
_gitConfig[key] = int(gitConfig(key, '--int'))
except ValueError:
_gitConfig[key] = None
return _gitConfig[key]
def gitConfigList(key):
if not _gitConfig.has_key(key):
s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment