Skip to content

Commit

Permalink
git-p4: fix filetype detection on files opened exclusively
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Blair Holloway authored and Junio C Hamano committed Apr 4, 2015
1 parent d077c2d commit 34a0dbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def getP4OpenedType(file):
# Returns the perforce file type for the given file.

result = p4_read_pipe(["opened", wildcard_encode(file)])
match = re.match(".*\((.+)\)\r?$", result)
match = re.match(".*\((.+)\)( \*exclusive\*)?\r?$", result)
if match:
return match.group(1)
else:
Expand Down
4 changes: 2 additions & 2 deletions t/t9816-git-p4-locked.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_expect_success 'edit with lock not taken' '
)
'

test_expect_failure 'add with lock not taken' '
test_expect_success 'add with lock not taken' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
Expand Down Expand Up @@ -107,7 +107,7 @@ test_expect_failure 'chmod with lock taken' '
)
'

test_expect_failure 'copy with lock taken' '
test_expect_success 'copy with lock taken' '
lock_in_another_client &&
test_when_finished cleanup_git &&
test_when_finished "cd \"$cli\" && p4 revert file2 && rm -f file2" &&
Expand Down

0 comments on commit 34a0dbf

Please sign in to comment.