Fix common path "calculation" from logs of multiple branches.
[gitweb.git] / contrib / fast-import / git-p4
index e576f2dd9efb39fcb86eda826b18a059828a87ef..ba34f0a61f10aabf9ab8cf712d02bf3a15b33224 100755 (executable)
@@ -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