git-p4: Correct branch base depot path detection

When branch detection is enabled each branch is named in git after their
relative depot path in Perforce. To do this the depot paths are compared against
each other to find their common base path. The current algorithm makes this
comparison on a character by character basis.
Assuming we have the following branches:

  //depot/branches/featureA
  //depot/branches/featureB

Then the base depot path would be //depot/branches/feature, which is an invalid
depot path.

The current patch fixes this by splitting the path into a list and comparing the
list entries, making it choose correctly //depot/branches as the base path.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: 525ec022ea6c5a82818d04a9bec49a44a46bb73e
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. perl/
  11. po/
  12. ppc/
  13. t/
  14. templates/
  15. vcs-svn/
  16. xdiff/
  17. .gitattributes
  18. .gitignore
  19. .mailmap
  20. abspath.c
  21. aclocal.m4
  22. advice.c
  23. advice.h
  24. alias.c
  25. alloc.c
  26. archive-tar.c
  27. archive-zip.c
  28. archive.c
  29. archive.h
  30. attr.c
  31. attr.h
  32. base85.c
  33. bisect.c
  34. bisect.h
  35. blob.c
  36. blob.h
  37. branch.c
  38. branch.h
  39. builtin.h
  40. bundle.c
  41. bundle.h
  42. cache-tree.c
  43. cache-tree.h
  44. cache.h
  45. check-builtins.sh
  46. check-racy.c
  47. check_bindir
  48. color.c
  49. color.h
  50. combine-diff.c
  51. command-list.txt
  52. commit.c
  53. commit.h
  54. config.c
  55. config.mak.in
  56. configure.ac
  57. connect.c
  58. convert.c
  59. convert.h
  60. copy.c
  61. COPYING
  62. csum-file.c
  63. csum-file.h
  64. ctype.c
  65. daemon.c
  66. date.c
  67. decorate.c
  68. decorate.h
  69. delta.h
  70. diff-delta.c
  71. diff-lib.c
  72. diff-no-index.c
  73. diff.c
  74. diff.h
  75. diffcore-break.c
  76. diffcore-delta.c
  77. diffcore-order.c
  78. diffcore-pickaxe.c
  79. diffcore-rename.c
  80. diffcore.h
  81. dir.c
  82. dir.h
  83. editor.c
  84. entry.c
  85. environment.c
  86. exec_cmd.c
  87. exec_cmd.h
  88. fast-import.c
  89. fetch-pack.h
  90. fixup-builtins
  91. fsck.c
  92. fsck.h
  93. generate-cmdlist.sh
  94. gettext.c
  95. gettext.h
  96. git-add--interactive.perl
  97. git-am.sh
  98. git-archimport.perl
  99. git-bisect.sh
  100. git-compat-util.h
  101. git-cvsexportcommit.perl
  102. git-cvsimport.perl
  103. git-cvsserver.perl
  104. git-difftool--helper.sh
  105. git-difftool.perl
  106. git-filter-branch.sh
  107. git-instaweb.sh
  108. git-lost-found.sh
  109. git-merge-octopus.sh
  110. git-merge-one-file.sh
  111. git-merge-resolve.sh
  112. git-mergetool--lib.sh
  113. git-mergetool.sh
  114. git-parse-remote.sh
  115. git-pull.sh
  116. git-quiltimport.sh
  117. git-rebase--am.sh
  118. git-rebase--interactive.sh
  119. git-rebase--merge.sh
  120. git-rebase.sh
  121. git-relink.perl
  122. git-remote-testgit.py
  123. git-repack.sh
  124. git-request-pull.sh
  125. git-send-email.perl
  126. git-sh-i18n.sh
  127. git-sh-setup.sh
  128. git-stash.sh
  129. git-submodule.sh
  130. git-svn.perl
  131. GIT-VERSION-GEN
  132. git-web--browse.sh
  133. git.c
  134. git.spec.in
  135. graph.c
  136. graph.h
  137. grep.c
  138. grep.h
  139. hash.c
  140. hash.h
  141. help.c
  142. help.h
  143. hex.c
  144. http-backend.c
  145. http-fetch.c
  146. http-push.c
  147. http-walker.c
  148. http.c
  149. http.h
  150. ident.c
  151. imap-send.c
  152. INSTALL
  153. levenshtein.c
  154. levenshtein.h
  155. LGPL-2.1
  156. list-objects.c
  157. list-objects.h
  158. ll-merge.c
  159. ll-merge.h
  160. lockfile.c
  161. log-tree.c
  162. log-tree.h
  163. mailmap.c
  164. mailmap.h
  165. Makefile
  166. match-trees.c
  167. merge-file.c
  168. merge-file.h
  169. merge-recursive.c
  170. merge-recursive.h
  171. name-hash.c
  172. notes-cache.c
  173. notes-cache.h
  174. notes-merge.c
  175. notes-merge.h
  176. notes.c
  177. notes.h
  178. object.c
  179. object.h
  180. pack-check.c
  181. pack-refs.c
  182. pack-refs.h
  183. pack-revindex.c
  184. pack-revindex.h
  185. pack-write.c
  186. pack.h
  187. pager.c
  188. parse-options.c
  189. parse-options.h
  190. patch-delta.c
  191. patch-ids.c
  192. patch-ids.h
  193. path.c
  194. pkt-line.c
  195. pkt-line.h
  196. preload-index.c
  197. pretty.c
  198. progress.c
  199. progress.h
  200. quote.c
  201. quote.h
  202. reachable.c
  203. reachable.h
  204. read-cache.c
  205. README
  206. reflog-walk.c
  207. reflog-walk.h
  208. refs.c
  209. refs.h
  210. remote-curl.c
  211. remote.c
  212. remote.h
  213. replace_object.c
  214. rerere.c
  215. rerere.h
  216. resolve-undo.c
  217. resolve-undo.h
  218. revision.c
  219. revision.h
  220. run-command.c
  221. run-command.h
  222. send-pack.h
  223. server-info.c
  224. setup.c
  225. sh-i18n--envsubst.c
  226. sha1-array.c
  227. sha1-array.h
  228. sha1-lookup.c
  229. sha1-lookup.h
  230. sha1_file.c
  231. sha1_name.c
  232. shallow.c
  233. shell.c
  234. shortlog.h
  235. show-index.c
  236. sideband.c
  237. sideband.h
  238. sigchain.c
  239. sigchain.h
  240. strbuf.c
  241. strbuf.h
  242. streaming.c
  243. streaming.h
  244. string-list.c
  245. string-list.h
  246. submodule.c
  247. submodule.h
  248. symlinks.c
  249. tag.c
  250. tag.h
  251. tar.h
  252. test-chmtime.c
  253. test-ctype.c
  254. test-date.c
  255. test-delta.c
  256. test-dump-cache-tree.c
  257. test-genrandom.c
  258. test-index-version.c
  259. test-line-buffer.c
  260. test-match-trees.c
  261. test-mktemp.c
  262. test-obj-pool.c
  263. test-parse-options.c
  264. test-path-utils.c
  265. test-run-command.c
  266. test-sha1.c
  267. test-sha1.sh
  268. test-sigchain.c
  269. test-string-pool.c
  270. test-subprocess.c
  271. test-svn-fe.c
  272. test-treap.c
  273. thread-utils.c
  274. thread-utils.h
  275. trace.c
  276. transport-helper.c
  277. transport.c
  278. transport.h
  279. tree-diff.c
  280. tree-walk.c
  281. tree-walk.h
  282. tree.c
  283. tree.h
  284. unimplemented.sh
  285. unpack-trees.c
  286. unpack-trees.h
  287. upload-pack.c
  288. url.c
  289. url.h
  290. usage.c
  291. userdiff.c
  292. userdiff.h
  293. utf8.c
  294. utf8.h
  295. walker.c
  296. walker.h
  297. wrap-for-bin.sh
  298. wrapper.c
  299. write_or_die.c
  300. ws.c
  301. wt-status.c
  302. wt-status.h
  303. xdiff-interface.c
  304. xdiff-interface.h
  305. zlib.c