git: Use 3-way merge when applying patches
diff mbox

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

Commit Message

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

Switch to using 3-way merging as this helps with a lot of situations where
there are minor, but automatically-resolvable conflicts.

See
http://stackoverflow.com/questions/4129049/why-is-a-3-way-merge-advantageous-over-a-2-way-merge

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 | 1 +
 1 file changed, 1 insertion(+)

Patch
diff mbox

diff --git a/src/git.rs b/src/git.rs
index 9be867f..071f009 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -69,6 +69,7 @@  pub fn apply_patch(repo: &Repository, path: &Path)
     // We call out to "git am" since libgit2 doesn't implement "am"
     let output = Command::new("git")
         .arg("am") // apply from mbox
+        .arg("-3") // three way merge
         .arg(&path) // from our mbox file
         .current_dir(&workdir) // in the repo's working directory
         .output() // run synchronously