On Tuesday, January 15, 2013 3:24:34 AM UTC+1, Tim Chase wrote:

> I was playing around with some of the information that rev-parse can 
> return and just tried --is-inside-work-tree to see what it would 
> return.  As expected, in my working-dir $PROJ, it returns "true". 
> Same for within $PROJ/.git and $PROJ/dir_with_nothing_tracked 
> However, when I try "git rev-parse --is-inside-work-tree" outside my 
> repo, I get 
> fatal: Not a git repository (or any parent up to mount point /home) 
> Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not 
> set). 
> According to my reading of the docs/man-pages, I should get "false" 
> instead.  Under what conditions should rev-parse return false? 

 As far as I understand, there are three related queries here:

   1. is-inside-git-dir
   2. is-inside-work-tree
   3. is-bare-repository

They are used to discern whether you are inside the repo/.git dir, or in 
the work-tree. 

If you are in a bare repository, the first one will happen to always be 
true, but if you want to know whether you're in a bare repository or not, 
the third one is the one to use.


Reply via email to