Code

git-p4: use absolute directory for PWD env var
[git.git] / contrib / fast-import / git-p4
index 122b7c28640deb56bd2f8df99c960d415fab64ac..7d8e74b6ddb3e17ce3d2fdfd7b4bcdf28a7e7a2f 100755 (executable)
@@ -53,9 +53,10 @@ def p4_build_cmd(cmd):
 
 def chdir(dir):
     # P4 uses the PWD environment variable rather than getcwd(). Since we're
-    # not using the shell, we have to set it ourselves.
-    os.environ['PWD']=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()
 
 def die(msg):
     if verbose: