Find information about the git repository, if this file is in a clone.

        :param gitdir: path to the git repo's .git directory
        :type gitdir: str
        :returns: information about the git clone
        :rtype: dict

def _find_git_info(self, gitdir):
        """
        Find information about the git repository, if this file is in a clone.

        :param gitdir: path to the git repo's .git directory
        :type gitdir: str
        :returns: information about the git clone
        :rtype: dict
        """
        res = {'remotes': None, 'tag': None, 'commit': None, 'dirty': None}
        try:
            logger.debug('opening %s as git.Repo', gitdir)
            repo = Repo(path=gitdir, search_parent_directories=False)
            res['commit'] = repo.head.commit.hexsha
            res['dirty'] = repo.is_dirty(untracked_files=True)
            res['remotes'] = {}
            for rmt in repo.remotes:
                # each is a git.Remote
                urls = [u for u in rmt.urls]  # generator
                if len(urls) > 0:
                    res['remotes'][rmt.name] = urls[0]
            for tag in repo.tags:
                # each is a git.Tag object
                if tag.commit.hexsha == res['commit']:
                    res['tag'] = tag.name
        except Exception:
            logger.debug('Exception getting git information', exc_info=True)
        return res