Re: Git 1.8.4.2: 'git-rev-parse --is-inside-git-dir' wrong output!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 01, 2013 at 06:19:51PM -0500, Ville Walveranta wrote:
> "git-rev-parse --is-inside-git-dir" outputs "fatal: Not a git
> repository (or any of the parent directories): .git", instead of
> "false" when outside of a git directory.  "--is-inside-work-tree"
> behaves the same way. Both commands work correctly (i.e. output
> "true") when inside a git directory, or inside a work tree,
> respectively.

I think that's intentional - and it looks like the behaviour has not
changed since these options were added.  With the current behaviour you
get three possible outcomes from "git rev-parse --is-inside-work-tree":

    if worktree=$(git rev-parse --is-inside-work-tree 2>/dev/null)
    then
        if test "$worktree" = true
        then
            echo 'inside work tree'
        else
            echo 'in repository, but not in work tree'
        fi
    else
        echo 'not in repository'
    fi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]