Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-p4: add gitConfigInt reader
author
Lars Schneider
<larsxschneider@gmail.com>
Sat, 26 Sep 2015 07:54:59 +0000
(09:54 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 3 Oct 2015 17:21:13 +0000
(10:21 -0700)
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: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
692e179
)
diff --git
a/git-p4.py
b/git-p4.py
index 206a45f613257028fc633ef96a2fb61e6371cbb2..c99b077884756e01b697e1abf53e08482e6712c3 100755
(executable)
--- a/
git-p4.py
+++ b/
git-p4.py
@@
-623,6
+623,17
@@
def gitConfigBool(key):
_gitConfig[key] = gitConfig(key, '--bool') == "true"
return _gitConfig[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()
+ try:
+ _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)
def gitConfigList(key):
if not _gitConfig.has_key(key):
s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)