Skip to contentSkip to conversation

Discard stderr output from git apply

PATCH In review Karl Hasselström 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Discard stderr output from git apply

It prints error messages when it fails, and we don't need to see them since we don't care exactly _why_ it failed.

---

With the optimizations that make us start using apply a lot; I noticed git apply was spamming on stderr.

 stgit/lib/git.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
stgit/lib/git.py +1 -1
index 6ccdfa7..9208965 100644
@@ -556,7 +556,7 @@ class Index(RunWithEnv):
         """In-index patch application, no worktree involved."""
         try:
             self.run(['git', 'apply', '--cached']
-                     ).raw_input(patch_text).no_output()
+                     ).raw_input(patch_text).discard_stderr().no_output()
         except run.RunException:
             raise MergeException('Patch does not apply cleanly')
     def delete(self):
#1 lore raw

2008/7/4 Karl Hasselström <[email protected]>:

Quoted 2 lines

It prints error messages when it fails, and we don't need to see them since we don't care exactly _why_ it failed.

Are you sure we don't need this? I found it useful when running "import" to see why a patch failed.

Signature · 1 line
Catalin
#2 lore raw
Quoted 7 lines · Catalin Marinas

2008/7/4 Karl Hasselström <[email protected]>:

Quoted 2 lines

It prints error messages when it fails, and we don't need to see them since we don't care exactly _why_ it failed.

Are you sure we don't need this? I found it useful when running "import" to see why a patch failed.

Aww, you're right. Apply isn't just called from the simple merge fast path, it's also used to apply patches. Who would've guessed? ;-)

I'll add a parameter to shut it up or not depending on the caller's preferences.

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle