def run_git(args, git_path=_DEFAULT_GIT, input=None, capture_stdout=False, **popen_kwargs):
 env = popen_kwargs.pop('env', {})
 env['LC_ALL'] = env['LANG'] = 'C'
 args = ([git_path] + args)
 popen_kwargs['stdin'] = subprocess.PIPE
 if capture_stdout:
  popen_kwargs['stdout'] = subprocess.PIPE
 else:
  popen_kwargs.pop('stdout', None)
 p = subprocess.Popen(args, env=env, **popen_kwargs)
 (stdout, stderr) = p.communicate(input=input)
 return (p.returncode, stdout)

def run_git ( args , git_path = _DEFAULT_GIT , input = None , capture_stdout = False , ** popen_kwargs ) : env = popen_kwargs . pop ( 'env' , { } ) env [ 'LC_ALL' ] = env [ 'LANG' ] = 'C' args = ( [ git_path ] + args ) popen_kwargs [ 'stdin' ] = subprocess . PIPE if capture_stdout : popen_kwargs [ 'stdout' ] = subprocess . PIPE else : popen_kwargs . pop ( 'stdout' , None ) p = subprocess . Popen ( args , env = env , ** popen_kwargs ) ( stdout , stderr ) = p . communicate ( input = input ) return ( p . returncode , stdout )
run a git command .