فهرست منبع

Got rid of 'Unpacking objects' messages produced by git-receive-pack. Unfortunately there's no command line options to silence this message, so the only way is to redirect stderr.

Chris Eberle 13 سال پیش
والد
کامیت
0619b382f9
2فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 7 1
      dulwich/client.py
  2. 1 1
      dulwich/tests/compat/test_client.py

+ 7 - 1
dulwich/client.py

@@ -524,6 +524,11 @@ class SubprocessGitClient(TraditionalGitClient):
 
     def __init__(self, *args, **kwargs):
         self._connection = None
+        self._redirect_stderr = None
+        if 'redirect_stderr' in kwargs:
+            if kwargs['redirect_stderr']:
+                self._redirect_stderr = subprocess.PIPE
+            del kwargs['redirect_stderr']
         GitClient.__init__(self, *args, **kwargs)
 
     def _connect(self, service, path):
@@ -531,7 +536,8 @@ class SubprocessGitClient(TraditionalGitClient):
         argv = ['git', service, path]
         p = SubprocessWrapper(
             subprocess.Popen(argv, bufsize=0, stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE))
+                             stdout=subprocess.PIPE,
+                             stderr=self._redirect_stderr))
         return Protocol(p.read, p.write,
                         report_activity=self._report_activity), p.can_read
 

+ 1 - 1
dulwich/tests/compat/test_client.py

@@ -272,7 +272,7 @@ class DulwichSubprocessClientTest(CompatTestCase, DulwichClientTestBase):
         CompatTestCase.tearDown(self)
 
     def _client(self):
-        return client.SubprocessGitClient()
+        return client.SubprocessGitClient(redirect_stderr=True)
 
     def _build_path(self, path):
         return self.gitroot + path