git-p4: respect excluded paths when detecting branches

Currently, excluded paths are only handled in the following cases:
 * no branch detection;
 * branch detection with using clientspec.

However, excluded paths are not respected in case of
branch detection without using clientspec.

Fix this by consulting the list of excluded paths
when splitting files across branches.

Signed-off-by: Andrey Mazo <amazo@checkvideo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Mazo, Andrey 2019-04-01 18:02:38 +00:00 committed by Junio C Hamano
parent 607a3be6d0
commit d15068a650
2 changed files with 2 additions and 3 deletions

View File

@ -2710,8 +2710,7 @@ class P4Sync(Command, P4UserMap):
fnum = 0 fnum = 0
while "depotFile%s" % fnum in commit: while "depotFile%s" % fnum in commit:
path = commit["depotFile%s" % fnum] path = commit["depotFile%s" % fnum]
found = [p for p in self.depotPaths found = self.isPathWanted(path)
if p4PathStartsWith(path, p)]
if not found: if not found:
fnum = fnum + 1 fnum = fnum + 1
continue continue

View File

@ -412,7 +412,7 @@ test_expect_failure 'git p4 clone file subset branch' '
' '
# Check that excluded files are omitted during import # Check that excluded files are omitted during import
test_expect_failure 'git p4 clone complex branches with excluded files' ' test_expect_success 'git p4 clone complex branches with excluded files' '
test_when_finished cleanup_git && test_when_finished cleanup_git &&
test_create_repo "$git" && test_create_repo "$git" &&
( (