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>

Mazo, Andrey committed Apr 1, 2019 at 18:02 UTC d15068a6501bec72fddec9f79372a5e3ce5e1379
2 files changed +2 -3
git-p4.py
+1 -2
@@ -2710,8 +2710,7 @@ class P4Sync(Command, P4UserMap):
2710 fnum = 0
2711 while "depotFile%s" % fnum in commit:
2712 path = commit["depotFile%s" % fnum]
2713 - found = [p for p in self.depotPaths
2714 - if p4PathStartsWith(path, p)]
2713 + found = self.isPathWanted(path)
2714 if not found:
2715 fnum = fnum + 1
2716 continue
t/t9801-git-p4-branch.sh
+1 -1
@@ -412,7 +412,7 @@ test_expect_failure 'git p4 clone file subset branch' '
412 '
413
414 # Check that excluded files are omitted during import
415 -test_expect_failure 'git p4 clone complex branches with excluded files' '
415 +test_expect_success 'git p4 clone complex branches with excluded files' '
416 test_when_finished cleanup_git &&
417 test_create_repo "$git" &&
418 (