git-p4: respect excluded paths when detecting branches
authorMazo, Andrey <amazo@checkvideo.com>
Mon, 1 Apr 2019 18:02:38 +0000 (18:02 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2019 02:25:42 +0000 (11:25 +0900)
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>
git-p4.py
t/t9801-git-p4-branch.sh
index c47bd8c4d899a09d0693d7f169da12d8d0028a74..96c4b78dc7c8f4ea70975878e8c4f18ab629e82c 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -2710,8 +2710,7 @@ def splitFilesIntoBranches(self, commit):
         fnum = 0
         while "depotFile%s" % fnum in commit:
             path =  commit["depotFile%s" % fnum]
-            found = [p for p in self.depotPaths
-                     if p4PathStartsWith(path, p)]
+            found = self.isPathWanted(path)
             if not found:
                 fnum = fnum + 1
                 continue
index 7530d22de290a4c212ad1835e502e59384c78e74..9654362052a80fc2eef8cc4257ad2aea4a883696 100755 (executable)
@@ -412,7 +412,7 @@ test_expect_failure 'git p4 clone file subset branch' '
 '
 
 # 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_create_repo "$git" &&
        (