Skip to content

Commit 7f705dc

Browse files
torarvidgitster
authored andcommitted
git-p4: Fix bug in p4Where method.
When running: p4 where //depot/SomePath/... The result can in some situations look like: //depot/SomePath/... //client/SomePath/... /home/user/p4root/SomePath/... -//depot/SomePath/UndesiredSubdir/... //client/SomePath/UndesiredSubdir/... /home/user/p4root/SomePath/UndesiredSubdir/... This depends on the users Client view. The current p4Where method will now return /home/user/p4root/SomePath/UndesiredSubdir/... which is not what we want. This patch loops through the results from "p4 where", and picks the one where the depotFile exactly matches the given depotPath (//depot/SomePath/... in this example). Signed-off-by: Tor Arvid Lund <torarvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 304dcf2 commit 7f705dc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,15 @@ def p4Cmd(cmd):
245245
def p4Where(depotPath):
246246
if not depotPath.endswith("/"):
247247
depotPath += "/"
248-
output = p4Cmd("where %s..." % depotPath)
248+
depotPath = depotPath + "..."
249+
outputList = p4CmdList("where %s" % depotPath)
250+
output = None
251+
for entry in outputList:
252+
if entry["depotFile"] == depotPath:
253+
output = entry
254+
break
255+
if output == None:
256+
return ""
249257
if output["code"] == "error":
250258
return ""
251259
clientPath = ""

0 commit comments

Comments
 (0)