Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMazo, Andrey <amazo@checkvideo.com>2019-04-01 21:02:24 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-02 05:25:41 +0300
commitf2768cb343cb0320f79692625dea7f50af643759 (patch)
tree7e0e0bea253ef926b7fe682a680bf64414772ce5 /git-p4.py
parentb30efb156f148081bfb912a2269666864e3937b2 (diff)
git-p4: match branches case insensitively if configured
git-p4 knows how to handle case insensitivity in file paths if core.ignorecase is set. However, when determining a branch for a file, it still does a case-sensitive prefix match. This may result in some file changes to be lost on import. For example, given the following commits 1. add //depot/main/file1 2. add //depot/DirA/file2 3. add //depot/dira/file3 4. add //depot/DirA/file4 and "branchList = main:DirA" branch mapping, commit 3 will be lost. So, do branch search case insensitively if running with core.ignorecase set. Teach splitFilesIntoBranches() to use the p4PathStartsWith() function for path prefix matches instead of always case-sensitive match. Signed-off-by: Andrey Mazo <amazo@checkvideo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-p4.py b/git-p4.py
index c0a3068b6f..f3e5ccb7af 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2668,7 +2668,7 @@ class P4Sync(Command, P4UserMap):
path = self.clientSpecDirs.map_in_client(path)
if self.detectBranches:
for b in self.knownBranches:
- if path.startswith(b + "/"):
+ if p4PathStartsWith(path, b + "/"):
path = path[len(b)+1:]
elif self.keepRepoPath:
@@ -2723,7 +2723,7 @@ class P4Sync(Command, P4UserMap):
for branch in self.knownBranches.keys():
# add a trailing slash so that a commit into qt/4.2foo
# doesn't end up in qt/4.2, e.g.
- if relPath.startswith(branch + "/"):
+ if p4PathStartsWith(relPath, branch + "/"):
if branch not in branches:
branches[branch] = []
branches[branch].append(file)