Skip to content

Commit abcaf07

Browse files
Anand Kumriagitster
authored andcommitted
If the user has configured various parameters, use them.
Some repositories require authentication and access to certain hosts. Allow git-p4 to pull this information from the configuration Signed-off-by: Anand Kumria <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 155af83 commit abcaf07

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,29 @@ def p4_build_cmd(cmd):
2424
location. It means that hooking into the environment, or other configuration
2525
can be done more easily.
2626
"""
27-
real_cmd = "%s %s" % ("p4", cmd)
27+
real_cmd = "%s " % "p4"
28+
29+
user = gitConfig("git-p4.user")
30+
if len(user) > 0:
31+
real_cmd += "-u %s " % user
32+
33+
password = gitConfig("git-p4.password")
34+
if len(password) > 0:
35+
real_cmd += "-P %s " % password
36+
37+
port = gitConfig("git-p4.port")
38+
if len(port) > 0:
39+
real_cmd += "-p %s " % port
40+
41+
host = gitConfig("git-p4.host")
42+
if len(host) > 0:
43+
real_cmd += "-h %s " % host
44+
45+
client = gitConfig("git-p4.client")
46+
if len(client) > 0:
47+
real_cmd += "-c %s " % client
48+
49+
real_cmd += "%s" % (cmd)
2850
if verbose:
2951
print real_cmd
3052
return real_cmd

0 commit comments

Comments
 (0)