提交 99f790f2 编写于 作者: T Tor Arvid Lund 提交者: Junio C Hamano

git-p4: Teach gitConfig method about arguments.

With this patch, it is possible to call the gitConfig method with an optional
argument string, which will be passed to the "git config" executable. For
instance:

gitConfig("core.ignorecase", "--bool")

will ensure that you get the value "true", and won't have to check the returned
value for [1, true, on, yes].
Signed-off-by: NTor Arvid Lund <torarvid@gmail.com>
Acked-by: NPete Wyckoff <pw@padd.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 a35138af
......@@ -333,9 +333,13 @@ def gitBranchExists(branch):
return proc.wait() == 0;
_gitConfig = {}
def gitConfig(key):
def gitConfig(key, args = None): # set args to "--bool", for instance
if not _gitConfig.has_key(key):
_gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip()
argsFilter = ""
if args != None:
argsFilter = "%s " % args
cmd = "git config %s%s" % (argsFilter, key)
_gitConfig[key] = read_pipe(cmd, ignore_error=True).strip()
return _gitConfig[key]
def p4BranchesInGit(branchesAreInRemotes = True):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册