From ba3b2132f5ffa852579734a350104a719f654b64 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 11 Nov 2012 13:39:41 +0000 Subject: Improve the way we find repo paths This patch improves the way we find the path to the repositories, both in the recursive and in the non-recursive cases. We now support specifying non-bare repositories directly, and also recursing on them. Signed-off-by: Alberto Bertogli --- git.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'git.py') diff --git a/git.py b/git.py index 023f1a6..d005b13 100644 --- a/git.py +++ b/git.py @@ -41,7 +41,7 @@ class EncodeWrapper: return s.decode(self.encoding, errors = self.errors) -def run_git(repo_path, params, stdin = None): +def run_git(repo_path, params, stdin = None, silent_stderr = False): """Invokes git with the given parameters. This function invokes git with the given parameters, and returns a @@ -49,11 +49,17 @@ def run_git(repo_path, params, stdin = None): """ params = [GIT_BIN, '--git-dir=%s' % repo_path] + list(params) + stderr = None + if silent_stderr: + stderr = subprocess.PIPE + if not stdin: - p = subprocess.Popen(params, stdin = None, stdout = subprocess.PIPE) + p = subprocess.Popen(params, + stdin = None, stdout = subprocess.PIPE, stderr = stderr) else: p = subprocess.Popen(params, - stdin = subprocess.PIPE, stdout = subprocess.PIPE) + stdin = subprocess.PIPE, stdout = subprocess.PIPE, + stderr = stderr) p.stdin.write(stdin) p.stdin.close() -- cgit v1.2.3