Use parent directory not parent project to locate gitdir

When searching for the git directory of a project the search follows
the project's basedir parent directory rather than following the
project hierarchy (which is not correct)