def run_git(self, args, git_env=None):
popen_kwargs = {<EOL>'<STR_LIT>': subprocess.PIPE,<EOL>'<STR_LIT>': subprocess.PIPE,<EOL>}<EOL>if git_env:<EOL><INDENT>popen_kwargs['<STR_LIT>'] = git_env<EOL><DEDENT>if self._git_toplevel:<EOL><INDENT>popen_kwargs['<STR_LIT>'] = self._git_toplevel<EOL><DEDENT>git_process = subprocess.Popen(<EOL>[GitRunner._git_executable] + args,<EOL>**popen_kwargs<EOL>)<EOL>try:<EOL><INDENT>out, err = git_process.communicate()<EOL>git_process.wait()<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise GitError("<STR_LIT>".format(<EOL>args='<STR_LIT:U+0020>'.join(args),<EOL>newline=os.linesep,<EOL>ex=str(e)<EOL>))<EOL><DEDENT>if (<NUM_LIT:0> != git_process.returncode) or err:<EOL><INDENT>if err:<EOL><INDENT>err = err.decode('<STR_LIT>')<EOL><DEDENT>raise GitError("<STR_LIT>".format(<EOL>args='<STR_LIT:U+0020>'.join(args),<EOL>newline=os.linesep,<EOL>err=err<EOL>))<EOL><DEDENT>if not out:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return out.decode('<STR_LIT>').splitlines()<EOL>
Runs the git executable with the arguments given and returns a list of
lines produced on its standard output.