On Mon, Jul 11, 2011 at 4:01 PM, Richard Heck <rgh...@comcast.net> wrote:
> ** > On 07/11/2011 09:47 AM, Richard Heck wrote: > > On 07/11/2011 09:32 AM, Vincent van Ravesteijn wrote: > > > (i) is certainly fixable, in the sense that we can spawn "git status" > and check the return value, but it is not as easy as looking for .svn, say. > > > We can just copy-paste the code that git uses itself to detect whether it > is in a repo or not ? > > I'm a bit curious how it does this, actually. I mean: In such a way as > properly to follow symlinks. I run into this kind of problem often. E.g., > what ".." means seems to vary in a way I do not understand if you are in a > symlinked directory. > > For example: Suppose I am in /home/rgheck/; there is symlink from texmf to > files/texmf. (Here files/ is the mount point for an NFS directory.) If I cd > to /home/rgheck/texmf/, then: > (i) "cd .." takes me to /home/rgheck/, as expected > (ii) "ls .." gives me the files in /home/rgheck/files/, as not > expected. > It looks like git acts like ls. If you have a symlink in a git repo, then > the symlink is in the repo, but the stuff in the directory to which it > points is not (unless that directory is in the repo anyway). > > So this means that we can figure out if we are in a repo by looking up the > tree (apparently, stopping at the mount point, too, if I'm reading things > correctly). But we have to follow the REAL parent, not just strip off path > elements. I do not know how to do that, myself. Maybe the easiest way would > be first to get the real path to whatever directory we are in, then we can > strip off path elements looking for .git. I'm not sure about how to stop at > mount points, though. > I might be missing something basic, but are there any problems with using git status FILE_OF_LYX_FILE and to parse the output? Rainer > > Richard > > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax (F): +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug