def process()

in processors/git.py [0:0]


    def process(self, output_var='git'):
        if 'url' not in self.config:
            raise NotConfiguredException('No URL configured!')

        url = self._jinja_expand_string(self.config['url'], 'url')

        self._init_tempdir()

        if 'directory' in self.config:
            directory = self._jinja_expand_string(self.config['directory'],
                                                  'url')
            if directory and not os.path.exists(directory):
                self.logger.debug(
                    'Creating directory under temporary directory: %s' %
                    (directory))
                os.makedirs(directory, exist_ok=True)
        else:
            directory = './'

        clone_args = {}
        if 'depth' in self.config:
            clone_args['depth'] = self._jinja_expand_int(
                self.config['depth'], 'depth')
        self.logger.info('Cloning %s to %s' % (url, directory),
                         extra={
                             **{
                                 'url': url,
                                 'directory': directory
                             },
                             **clone_args
                         })

        if 'privateKey' in self.config:
            private_key = self._jinja_expand_dict(self.config['privateKey'],
                                                  'private_key')
            key_file = tempfile.TemporaryFile()
            key_file.write(private_key['key'].encode('utf-8'))
            git_ssh_cmd = 'ssh -i %s' % (key_file.name)
            with Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd):
                repo = Repo.clone_from(url, directory, **clone_args)
        else:
            repo = Repo.clone_from(url, directory, **clone_args)

        if 'branch' in self.config:
            branch = self._jinja_expand_string(self.config['branch'], 'branch')
            repo.git.checkout(branch)

        output = {
            'branch': repo.active_branch.name,
            'commit': {
                'id':
                    repo.head.commit.hexsha,
                'author':
                    "%s <%s>" % (repo.head.commit.author.name,
                                 repo.head.commit.author.email),
                'timestamp':
                    repo.head.commit.committed_datetime.isoformat(),
                'message':
                    repo.head.commit.message,
            },
            'directory': directory,
        }

        return {
            output_var: output,
        }