summaryrefslogtreecommitdiff
path: root/contrib/fast-import
diff options
context:
space:
mode:
authorSimon Hausmann <shausman@trolltech.com>2007-06-07 07:37:13 (GMT)
committerSimon Hausmann <shausman@trolltech.com>2007-06-07 07:37:13 (GMT)
commit583e170706f5d69770d0de220286f8f0f73667f3 (patch)
tree9764257011f5c1f96afff586187c5099a0f577f6 /contrib/fast-import
parent845b42cb6c1c1e80c4283234ea2162cae809bd50 (diff)
downloadgit-583e170706f5d69770d0de220286f8f0f73667f3.zip
git-583e170706f5d69770d0de220286f8f0f73667f3.tar.gz
git-583e170706f5d69770d0de220286f8f0f73667f3.tar.bz2
Fix common path "calculation" from logs of multiple branches.
Need to use min instead of max for prev/cur to avoid out-of-bounds string access. Also treat "i" as index of the last match instead of a length because in case of a complete match of the two strings i was off by one. Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-xcontrib/fast-import/git-p45
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e576f2d..ba34f0a 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -1059,11 +1059,12 @@ class P4Sync(Command):
else:
paths = []
for (prev, cur) in zip(self.previousDepotPaths, depotPaths):
- for i in range(0, max(len(cur), len(prev))):
+ for i in range(0, min(len(cur), len(prev))):
if cur[i] <> prev[i]:
+ i = i - 1
break
- paths.append (cur[:i])
+ paths.append (cur[:i + 1])
self.previousDepotPaths = paths