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 <blair_holloway@playstation.sony.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Blair Holloway committed Apr 4, 2015 at 09:46 UTC 34a0dbfc6b7463a68df79d5773102f85e56cbe4d
2 files changed +3 -3
git-p4.py
+1 -1
@@ -368,7 +368,7 @@ def getP4OpenedType(file):
368 # Returns the perforce file type for the given file.
369
370 result = p4_read_pipe(["opened", wildcard_encode(file)])
371 - match = re.match(".*\((.+)\)\r?$", result)
371 + match = re.match(".*\((.+)\)( \*exclusive\*)?\r?$", result)
372 if match:
373 return match.group(1)
374 else:
t/t9816-git-p4-locked.sh
+2 -2
@@ -35,7 +35,7 @@ test_expect_success 'edit with lock not taken' '
35 )
36 '
37
38 -test_expect_failure 'add with lock not taken' '
38 +test_expect_success 'add with lock not taken' '
39 test_when_finished cleanup_git &&
40 git p4 clone --dest="$git" //depot &&
41 (
@@ -107,7 +107,7 @@ test_expect_failure 'chmod with lock taken' '
107 )
108 '
109
110 -test_expect_failure 'copy with lock taken' '
110 +test_expect_success 'copy with lock taken' '
111 lock_in_another_client &&
112 test_when_finished cleanup_git &&
113 test_when_finished "cd \"$cli\" && p4 revert file2 && rm -f file2" &&