git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] git-p4: Teach gitConfig method about arguments.
@ 2011-03-15 12:08 Tor Arvid Lund
  2011-03-15 12:08 ` [PATCH 2/3] Teach git-p4 to ignore case in perforce filenames if configured Tor Arvid Lund
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tor Arvid Lund @ 2011-03-15 12:08 UTC (permalink / raw)
  To: git, Pete Wyckoff; +Cc: Tor Arvid Lund

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: Tor Arvid Lund <torarvid@gmail.com>
---
 contrib/fast-import/git-p4 |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 7cb479c..4425220 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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):
-- 
1.7.3.1.68.g06779.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-15 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15 12:08 [PATCH 1/3] git-p4: Teach gitConfig method about arguments Tor Arvid Lund
2011-03-15 12:08 ` [PATCH 2/3] Teach git-p4 to ignore case in perforce filenames if configured Tor Arvid Lund
2011-03-15 12:08 ` [PATCH 3/3] git-p4: Fix error message crash in P4Sync.commit Tor Arvid Lund
2011-03-15 21:44 ` [PATCH 1/3] git-p4: Teach gitConfig method about arguments Pete Wyckoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).