git: print info when apply fails
diff mbox

Message ID 20170203042448.10690-1-andrew.donnellan@au1.ibm.com
State Accepted
Headers show

Commit Message

Andrew Donnellan Feb. 3, 2017, 4:24 a.m. UTC
From: Russell Currey <ruscur@russell.cc>

It's useful to see the actual output of "git am" when patch application
fails. Print it accordingly.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

---

already merged, for information only

---
 src/git.rs | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox

diff --git a/src/git.rs b/src/git.rs
index 071f009..51362b5 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -80,6 +80,9 @@  pub fn apply_patch(repo: &Repository, path: &Path)
                  String::from_utf8(output.clone().stdout).unwrap());
         Ok(output)
     } else {
+        info!("Patch failed to apply with text {} {}",
+              String::from_utf8(output.clone().stdout).unwrap(),
+              String::from_utf8(output.clone().stderr).unwrap());
         Command::new("git").arg("am").arg("--abort")
             .current_dir(&workdir).output().unwrap();
         Err("Patch did not apply successfully")