new file mode 100755
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+test_description='git diff --merge/--ours/--theirs'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+test_expect_success setup '
+ test_write_lines initial >file &&
+ git add file &&
+ git commit -m initial &&
+
+ git checkout -b ours main &&
+ test_write_lines ours >file &&
+ git commit -a -m ours &&
+
+ git checkout -b theirs main &&
+ test_write_lines theirs >file &&
+ git commit -a -m theirs &&
+
+ git checkout ours^0 &&
+ test_must_fail git merge theirs &&
+
+ INITIAL=$(git rev-parse main) &&
+ OURS=$(git rev-parse ours) &&
+ THEIRS=$(git rev-parse theirs)
+'
+
+test_expect_success 'git diff --merge' '
+ git diff --merge | grep -v ^index >actual &&
+ cat >expect <<-\EOF &&
+ diff --cc file
+ --- a/file
+ +++ b/file
+ @@@ -1,1 -1,1 +1,1 @@@
+ - theirs
+ -initial
+ ++ours
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'git diff --ours' '
+ git diff --ours | grep -v ^index >actual &&
+ cat >expect <<-\EOF &&
+ * Unmerged path file
+ diff --git a/file b/file
+ --- a/file
+ +++ b/file
+ @@ -1 +1,5 @@
+ +<<<<<<< HEAD
+ ours
+ +=======
+ +theirs
+ +>>>>>>> theirs
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'git diff --theirs' '
+ git diff --theirs | grep -v ^index >actual &&
+ cat >expect <<-\EOF &&
+ * Unmerged path file
+ diff --git a/file b/file
+ --- a/file
+ +++ b/file
+ @@ -1 +1,5 @@
+ +<<<<<<< HEAD
+ +ours
+ +=======
+ theirs
+ +>>>>>>> theirs
+ EOF
+ test_cmp expect actual
+'
+
+test_done
These options don't seem to have any tests currently and the next patch in this series changes how these options are parsed. Add tests. Based loosely on t/t6417-merge-ours-theirs.sh. Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> --- t/t4070-diff-merge.sh | 79 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 t/t4070-diff-merge.sh