# [StGit PATCH] Discard stderr output from git apply

3 messages from 2008-07-04 to 2008-07-08. Participants: Karl Hasselström, Catalin Marinas.
Thread: https://gitlist.dev/t/14283

## Karl Hasselström, 2008-07-04 06:35

Subject: [StGit PATCH] Discard stderr output from git apply
Message-ID: <20080704063427.9515.68707.stgit@yoghurt>
URL: https://gitlist.dev/e/20080704063427.9515.68707.stgit%40yoghurt

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

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

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(-)


diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 6ccdfa7..9208965 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -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):

```

## Catalin Marinas, 2008-07-07 20:49

Subject: Re: [StGit PATCH] Discard stderr output from git apply
Message-ID: <b0943d9e0807071349u7c35d2fcr5025b2b282f290f6@mail.gmail.com>
URL: https://gitlist.dev/e/b0943d9e0807071349u7c35d2fcr5025b2b282f290f6%40mail.gmail.com
In-Reply-To: <20080704063427.9515.68707.stgit@yoghurt>

```
2008/7/4 Karl Hasselström <kha@treskal.com>:
> 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.

-- 
Catalin

```

## Karl Hasselström, 2008-07-08 04:39

Subject: Re: [StGit PATCH] Discard stderr output from git apply
Message-ID: <20080708043902.GD2247@diana.vm.bytemark.co.uk>
URL: https://gitlist.dev/e/20080708043902.GD2247%40diana.vm.bytemark.co.uk
In-Reply-To: <b0943d9e0807071349u7c35d2fcr5025b2b282f290f6@mail.gmail.com>

```
On 2008-07-07 21:49:31 +0100, Catalin Marinas wrote:

> 2008/7/4 Karl Hasselström <kha@treskal.com>:
>
> > 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.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

```
