git-p4: Fix p4 user cache population on Windows.
authorSimon Hausmann <simon@lst.de>
Wed, 25 Jul 2007 07:31:38 +0000 (09:31 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jul 2007 23:06:54 +0000 (16:06 -0700)
Fall back to USERPROFILE if HOME isn't set.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4

index e3404ca853c8b54f1a0c64be7038d282746652a7..1f5a56ee7ffcedb854d84023fdf61570dcffe67e 100755 (executable)
@@ -901,7 +901,8 @@ class P4Sync(Command):
                            % (labelDetails["label"], change))
 
     def getUserCacheFilename(self):
-        return os.environ["HOME"] + "/.gitp4-usercache.txt"
+        home = os.environ.get("HOME", os.environ.get("USERPROFILE"))
+        return home + "/.gitp4-usercache.txt"
 
     def getUserMapFromPerforceServer(self):
         if self.userMapFromPerforceServer: