git-p4, msysgit, and strange behavior

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

git-p4, msysgit, and strange behavior

Blum, Robert
Hi guys!


I've recently been evaluating DVCS's for work. (Actually, who am I kidding - I love working w/ DVCS and want to convince my bosses to move forward ;)

Since we're a Perforce & Windows shop, git-p4 and msysgit are mandatory. However, I've run into a strange bug. Running git-p4 submit, I always get the message '... - file(s) not in client view'. Yes, I've checked - the files are in the client view, the view is set up properly, talking to the correct server. This only occurs if I'm in any of the directories of the git repository. If I switch to the directories where the P4 data is synced to and use --git-origin, the submit works just fine.

After a bit of digging on the ML, I found http://marc.info/?l=git&m=120437559322494&w=3 and the thread related to it. And yes, indeed, changing all p4 calls like this:

        system("p4 sync ...") --> system("p4 sync %s..." % self.clientPath)

makes the problem go away. I've spent some time debugging the issue, and as far as I can tell, the working dir is set correctly during system(), the p4 environment is set correctly - and yet p4 complains.

As far as I know, I've grabbed the latest git & git-p4 from repo.or.cz. Is this a known problem? Should I clean up & submit the patch, or has anybody investigated a bit more why this is failing? (I don't like the patch because I don't understand *why* p4 fails to behave properly)


Help appreciated,
 - Robert

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

RE: git-p4, msysgit, and strange behavior

Blum, Robert
Hi Stephen!

> greetings from RWTH-Aachen ;-).

Heh - wonder who else from back then is lingering on those lists ;)

>Checked the environment?  I vaguely recall that p4 has some "magical
dependencies" there.

Yes, did that - 'p4 set' prints all relevant environment vars, and they seem to be set correctly.

You set me off on a slightly longer search, though. And indeed, here's the answer to the mystery (for the benefit of google/later readers).

Git-bash sets $PWD to your current working directory, and that variable is not affected by python's os.chdir(). (Neither in 2.5 nor 2.4, at least)

P4, for strange reasons, decides that that takes precedence over the actual working directory.

Well, actually not that strange. If p4 is using libiberty, they're using a version of getpwd that assumes that PWD is always up to date and no chdirs occur between calls to getpwd. I'm sure there was a good reason for that, but I really can't think why anybody would want to implement getpwd that way...


I'll create a patch for git-p4, but it's really up to P4 to actually *fix* that mess...

 - Robert

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html