def _get_commit_title(self):
        # Check if we're inside a git checkout
        try:
            subp = subprocess.Popen(  # nosec
                ['git', 'rev-parse', '--show-toplevel'],
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            gitdir = subp.communicate()[0].rstrip()
        except __HOLE__:
            # "git" was not found
            return None

        if not os.path.exists(gitdir):
            return None

        # Get title of most recent commit
        subp = subprocess.Popen(  # nosec
            ['git', 'log', '--no-merges', '--pretty=%s', '-1'],
            stdout=subprocess.PIPE)
        title = subp.communicate()[0]

        if subp.returncode:
            raise Exception("git log failed with code %s" % subp.returncode)
        return title.decode('utf-8')
dataset/ETHPy150Open openstack/sahara/sahara/utils/hacking/commit_message.py/GitCheck._get_commit_title