Commit cf653f2c authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

allow to do git command on directory not owned by the process

See https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
parent 6a26bd1c
import subprocess as _S
from os.path import dirname as _d
_d = _d(__file__)
import os.path as _P
_d = _P.realpath(_P.dirname(_P.dirname(__file__)))
def _git_call(*args):
return _S.call(("git",) + args, cwd=_d)
return _S.call(("git", "-c", "safe.directory=" + _d) + args, cwd=_d)
def _git_output(*args):
p = _S.Popen(("git",) + args, cwd=_d, stdout=_S.PIPE, stderr=_S.PIPE)
p = _S.Popen(
("git", "-c", "safe.directory=" + _d) + args,
cwd=_d,
stdout=_S.PIPE,
stderr=_S.PIPE)
out, err = p.communicate()
if p.returncode:
raise _S.CalledProcessError(p.returncode, "git", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment