2015-02-02 3:41 UTC-05:00, Chris Packham <judge.packham@xxxxxxxxx>: > [...] > But it actually looks like git rev-parse --resolve-git-dir $path needs > to be run inside a git repository _any_ git repository, which seems a > bit backwards to me. > [...] Indeed, looking at git-rev-parse(1), the correct option might be --show-toplevel, which will print the cwd if it is the top-level of a non-bare repository: cd $candidate && test $(git rev-parse --show-toplevel) = $candidate or test $(git --git-dir=$candidate rev-parse --show-toplevel) = $candidate Of course Git will resolve symlinks at this point, so $candidate has to be resolved first for the equality to make sense. Other solution is to parse the "gitdir: ..." format and recurse, which is not exactly hard (provided you speak Tcl). -- 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