[PATCH] git p4: chdir resolves symlinks only for relative paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[resending as plain text]

If a p4 client is configured to /p/foo which is a symlink
to /vol/bar/projects/foo, then resolving symlink, which
is done by git-p4's chdir will confuse p4: "Path
/vol/bar/projects/foo/... is not under client root /p/foo"
While AltRoots in p4 client specification can be used as a
workaround on p4 side, git-p4 should not resolve symlinks
in client paths.
chdir(dir) uses os.getcwd() after os.chdir(dir) to resolve
relative paths, but as a side effect it resolves symlinks
too. Now it checks if the dir is relative before resolving.

Signed-off-by: Miklós Fazekas <mfazekas@xxxxxxxxxxxx>
---
 git-p4.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/git-p4.py b/git-p4.py
index 2da5649..5d74649 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -64,7 +64,10 @@ def chdir(dir):
     # not using the shell, we have to set it ourselves.  This path could
     # be relative, so go there first, then figure out where we ended up.
     os.chdir(dir)
-    os.environ['PWD'] = os.getcwd()
+    if os.path.isabs(dir):
+        os.environ['PWD'] = dir
+    else:
+        os.environ['PWD'] = os.getcwd()

 def die(msg):
     if verbose:
-- 
1.7.10.2 (Apple Git-33)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]