[snowpatch] [PATCH] git: Use 3-way merge when applying patches

Andrew Donnellan andrew.donnellan at au1.ibm.com
Fri Feb 3 15:16:24 AEDT 2017


From: Russell Currey <ruscur at 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 at russell.cc>
Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---

Already merged, for information only

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

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
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the snowpatch mailing list