def _git_dir(repo, path):
    """ Find the git dir that's appropriate for the path"""
    name = "%s" % (path,)
    if name in ['HEAD', 'ORIG_HEAD', 'FETCH_HEAD', 'index', 'logs']:
        return repo.git_dir
    return repo.common_dir