Skip to content

Commit 98bae92

Browse files
committed
Added general variable git-p4.binary and added a default for windows of 'P4.EXE'
Signed-off-by: Ben Keene <[email protected]>
1 parent 0bca930 commit 98bae92

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Documentation/git-p4.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ git-p4.retries::
547547
Set the value to 0 to disable retries or if your p4 version
548548
does not support retries (pre 2012.2).
549549

550+
git-p4.binary::
551+
Specifies the p4 executable used by git-p4 to process commands.
552+
The default value for Windows is `p4.exe` and for all other
553+
systems the default is `p4`.
554+
550555
Clone and sync variables
551556
~~~~~~~~~~~~~~~~~~~~~~~~
552557
git-p4.syncFromOrigin::

git-p4.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import zlib
2727
import ctypes
2828
import errno
29+
import os.path
30+
from os import path
2931

3032
# support basestring in python3
3133
try:
@@ -85,7 +87,17 @@ def p4_build_cmd(cmd):
8587
location. It means that hooking into the environment, or other configuration
8688
can be done more easily.
8789
"""
88-
real_cmd = ["p4"]
90+
# Look for the P4 binary
91+
p4bin = gitConfig("git-p4.binary")
92+
real_cmd = []
93+
if p4bin != "":
94+
if path.exists(p4bin):
95+
real_cmd = [p4bin]
96+
if real_cmd == []:
97+
if (platform.system() == "Windows"):
98+
real_cmd = ["p4.exe"]
99+
else:
100+
real_cmd = ["p4"]
89101

90102
user = gitConfig("git-p4.user")
91103
if len(user) > 0:

0 commit comments

Comments
 (0)