get correct git dir even if in a subdirectory