On 08/19/2012 06:43 PM, Junio C Hamano wrote: > Michael Haggerty <mhag...@alum.mit.edu> writes: > >> I just verified that the combination of your two suggestions (i.e., the >> patch below) fixes the problem for me. > > Good to know. > > The only remaining two worries from me are if everybody has working > pwd at that early point in the script (I think MINGW replaces pwd > with its own), and if the latter one should really be "/bin/pwd" > everywhere. Saying "Give the true path to --root when you run it" > can sidestep the latter issue ;-) > >> Nevertheless, I'm not sure that this is the best solution. The test >> failures that occur without this change suggest to me that >> GIT_CEILING_DIRECTORIES is implemented in a fragile way. > > Hrmph. How would you improve it? chdir() around twice and compare?
I believe that the old-school method is to stat(2) the two directories and check whether their device IDs and inode numbers are identical. But I don't know whether that is portable to other allegedly POSIX-compatible OSs, or even works with all modern filesystems (I think there was just a thread about a FUSE filesystem that sometimes changes inode numbers). Another alternative is to write a function that knows how to convert an arbitrary path into an absolute path, including converting relative paths to absolute, resolving symlinks, eliminating redundant "/" and ".", resolving "..", and perhaps canonicalizing "/" vs. "\" and who-knows-what-else on Windows. It takes a bit of care to implement this correctly, but it might be a useful function to have around. Python's library function os.path.realpath() is an example . Either approach would avoid chdir()ing around even temporarily, which would anyway be bad form in git proper (as opposed to the test suite). And it would avoid the need to chdir() permanently in the test suite, which can have the effect of making directory names appear in unfamiliar forms. I'm afraid I don't have time to work on this now; I'm still trying to finish the next iteration of the post-receive-email hook script replacement. Michael  (Python) source code here: http://hg.python.org/cpython/file/20985f52b65e/Lib/posixfile.py -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html