From c728377bc619cae52cd6b85c78d02c0d6347a829 Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <andreas.fernandez@typo3.com>
Date: Tue, 11 Jul 2023 17:34:57 +0200
Subject: [PATCH] [BUGFIX] Consider output of `stderr` in successful cases

Git writes the output of some commands into `stderr` instead of
`stdout` (e.g. `push`). Using the option `--porcelain` doesn't always
help in such cases as other information may be missing. To get the full
output, `stderr` is now fetched in case `stdout` is empty.

Fixes: #205
---
 src/Gitonomy/Git/Repository.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Gitonomy/Git/Repository.php b/src/Gitonomy/Git/Repository.php
index fe77a88..091ddba 100644
--- a/src/Gitonomy/Git/Repository.php
+++ b/src/Gitonomy/Git/Repository.php
@@ -543,7 +543,7 @@ public function run($command, $args = [])
 
         $process->run();
 
-        $output = $process->getOutput();
+        $output = $process->getOutput() ?: $process->getErrorOutput();
 
         if ($this->logger && $this->debug) {
             $duration = microtime(true) - $before;