From: Junio C Hamano <gitster@pobox.com>
To: "Robert Blum" <rob.blum@gmail.com>
Cc: git@vger.kernel.org, Simon Hausmann <simon@lst.de>,
Han-Wen Nienhuys <hanwen@xs4all.nl>
Subject: Re: Fwd: [PATCH] git-p4: chdir now properly sets PWD environment variable in msysGit
Date: Fri, 15 Aug 2008 22:56:26 -0700 [thread overview]
Message-ID: <7vabfdjyet.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vskt5jyzh.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Fri, 15 Aug 2008 22:44:02 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> "Robert Blum" <rob.blum@gmail.com> writes:
>
>> Forgot reply-all - forwarding to list....
> ...
> I have been wondering what happened to this thread afterwards.
In the meantime, here is what I am inclined to apply. The same approach
as the original, taking stylistic suggestion from Han-Wen.
-- >8 --
From: Robert Blum <rob.blum@gmail.com>
Date: Fri, 1 Aug 2008 12:50:03 -0700
Subject: [PATCH] git-p4: chdir now properly sets PWD environment variable in msysGit
P4 on Windows expects the PWD environment variable to be set to the
current working dir, but os.chdir in python doesn't do so.
Signed-off-by: Robert Blum <rob.blum@gmail.com>
Acked-by: Simon Hausmann <simon@lst.de>
Acked-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
contrib/fast-import/git-p4 | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 6ae0429..3f2303d 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -16,6 +16,11 @@ from sets import Set;
verbose = False
+def chdir(dir):
+ if os.name == 'nt':
+ os.environ['PWD']=dir
+ os.chdir(dir)
+
def die(msg):
if verbose:
raise Exception(msg)
@@ -712,7 +717,7 @@ class P4Submit(Command):
print "Perforce checkout for depot path %s located at %s" % (self.depotPath, self.clientPath)
self.oldWorkingDirectory = os.getcwd()
- os.chdir(self.clientPath)
+ chdir(self.clientPath)
print "Syncronizing p4 checkout..."
system("p4 sync ...")
@@ -732,7 +737,7 @@ class P4Submit(Command):
if len(commits) == 0:
print "All changes applied!"
- os.chdir(self.oldWorkingDirectory)
+ chdir(self.oldWorkingDirectory)
sync = P4Sync()
sync.run([])
@@ -1670,7 +1675,7 @@ class P4Clone(P4Sync):
print "Importing from %s into %s" % (', '.join(depotPaths), self.cloneDestination)
if not os.path.exists(self.cloneDestination):
os.makedirs(self.cloneDestination)
- os.chdir(self.cloneDestination)
+ chdir(self.cloneDestination)
system("git init")
self.gitdir = os.getcwd() + "/.git"
if not P4Sync.run(self, depotPaths):
@@ -1782,7 +1787,7 @@ def main():
if os.path.exists(cmd.gitdir):
cdup = read_pipe("git rev-parse --show-cdup").strip()
if len(cdup) > 0:
- os.chdir(cdup);
+ chdir(cdup);
if not isValidGitDir(cmd.gitdir):
if isValidGitDir(cmd.gitdir + "/.git"):
--
1.6.0.rc3.11.g8134a
next prev parent reply other threads:[~2008-08-16 5:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 19:50 [PATCH] git-p4: chdir now properly sets PWD environment variable in msysGit Robert Blum
2008-08-03 21:13 ` Junio C Hamano
[not found] ` <bad7471c0808040601y10cceb44idcde5a4a8f415769@mail.gmail.com>
2008-08-04 13:04 ` Fwd: " Robert Blum
2008-08-16 5:44 ` Junio C Hamano
2008-08-16 5:56 ` Junio C Hamano [this message]
2008-08-05 8:24 ` Simon Hausmann
2008-08-04 3:06 ` Han-Wen Nienhuys
2008-08-05 22:23 ` Alex Riesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vabfdjyet.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hanwen@xs4all.nl \
--cc=rob.blum@gmail.com \
--cc=simon@lst.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).