Commit 74c37c2a48756299306bb10e9e546c1627ca289f

Jacques Germishuys 2015-03-12T13:16:09

Added options to enable patience and minimal diff drivers

diff --git a/include/git2/merge.h b/include/git2/merge.h
index e971f2d..d3360a7 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -134,6 +134,12 @@ typedef enum {
 
 	/** Ignore whitespace at end of line */
 	GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = (1 << 5),
+
+	/** Use the "patience diff" algorithm */
+	GIT_MERGE_FILE_DIFF_PATIENCE = (1 << 6),
+
+	/** Take extra time to find minimal diff */
+	GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
 } git_merge_file_flags_t;
 
 /**
diff --git a/src/merge_file.c b/src/merge_file.c
index 8bb003f..6d89b08 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -158,6 +158,12 @@ static int git_merge_file__from_inputs(
 	if (options.flags & GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL)
 		xmparam.xpp.flags |= XDF_IGNORE_WHITESPACE_AT_EOL;
 
+	if (options.flags & GIT_MERGE_FILE_DIFF_PATIENCE)
+		xmparam.xpp.flags |= XDF_PATIENCE_DIFF;
+
+	if (options.flags & GIT_MERGE_FILE_DIFF_MINIMAL)
+		xmparam.xpp.flags |= XDF_NEED_MINIMAL;
+
 	if ((xdl_result = xdl_merge(&ancestor_mmfile, &our_mmfile,
 		&their_mmfile, &xmparam, &mmbuffer)) < 0) {
 		giterr_set(GITERR_MERGE, "Failed to merge files.");