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