Skip to content

Commit 34a0dbf

Browse files
Blair Hollowaygitster
authored andcommitted
git-p4: fix filetype detection on files opened exclusively
If a Perforce server is configured to automatically set +l (exclusive lock) on add of certain file types, git p4 submit will fail during getP4OpenedType, as the regex doesn't expect the trailing '*exclusive*' from p4 opened: //depot/file.png#1 - add default change (binary+l) *exclusive* Signed-off-by: Blair Holloway <[email protected]> Acked-by: Luke Diamand <[email protected]> Signed-off-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d077c2d commit 34a0dbf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

git-p4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def getP4OpenedType(file):
368368
# Returns the perforce file type for the given file.
369369

370370
result = p4_read_pipe(["opened", wildcard_encode(file)])
371-
match = re.match(".*\((.+)\)\r?$", result)
371+
match = re.match(".*\((.+)\)( \*exclusive\*)?\r?$", result)
372372
if match:
373373
return match.group(1)
374374
else:

t/t9816-git-p4-locked.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test_expect_success 'edit with lock not taken' '
3535
)
3636
'
3737

38-
test_expect_failure 'add with lock not taken' '
38+
test_expect_success 'add with lock not taken' '
3939
test_when_finished cleanup_git &&
4040
git p4 clone --dest="$git" //depot &&
4141
(
@@ -107,7 +107,7 @@ test_expect_failure 'chmod with lock taken' '
107107
)
108108
'
109109

110-
test_expect_failure 'copy with lock taken' '
110+
test_expect_success 'copy with lock taken' '
111111
lock_in_another_client &&
112112
test_when_finished cleanup_git &&
113113
test_when_finished "cd \"$cli\" && p4 revert file2 && rm -f file2" &&

0 commit comments

Comments
 (0)