def branch(self):
        base = self._project_base()
        if base:
            head = os.path.join(self._project_base(), '.git', 'HEAD')
            try:
                with open(head, 'r', encoding='utf-8') as fh:
                    return u(fh.readline().strip().rsplit('/', 1)[-1])
            except __HOLE__:  # pragma: nocover
                try:
                    with open(head, 'r', encoding=sys.getfilesystemencoding()) as fh:
                        return u(fh.readline().strip().rsplit('/', 1)[-1])
                except:
                    log.traceback('warn')
            except IOError:  # pragma: nocover
                log.traceback('warn')
        return None
dataset/ETHPy150Open wakatime/sublime-wakatime/packages/wakatime/projects/git.py/Git.branch