summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t7606-merge-custom.sh36
1 files changed, 33 insertions, 3 deletions
diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh
index 82045cd543..13c219367d 100755
--- a/t/t7606-merge-custom.sh
+++ b/t/t7606-merge-custom.sh
@@ -4,11 +4,13 @@ test_description="git merge
Testing a custom strategy.
-* (HEAD, master) Merge commit 'c2'
+* (HEAD, master) Merge commit 'c3'
|\
-| * (tag: c2) c2
+| * (tag: c3) c3
* | (tag: c1) c1
|/
+| * tag: c2) c2
+|/
* (tag: c0) c0
"
@@ -31,7 +33,9 @@ test_expect_success 'setup' '
git reset --keep c0 &&
echo c1c1 >c1.c &&
git add c1.c &&
- test_commit c2 c2.c
+ test_commit c2 c2.c &&
+ git reset --keep c0 &&
+ test_commit c3 c3.c
'
test_expect_success 'merge c2 with a custom strategy' '
@@ -60,4 +64,30 @@ test_expect_success 'merge c2 with a custom strategy' '
test -f c2.c
'
+test_expect_success 'trivial merge with custom strategy' '
+ git reset --hard c1 &&
+
+ git rev-parse c1 >head.old &&
+ git rev-parse c3 >second-parent.expected &&
+ git rev-parse c3^{tree} >tree.expected &&
+ git merge -s theirs c3 &&
+
+ git rev-parse HEAD >head &&
+ git rev-parse HEAD^1 >first-parent &&
+ git rev-parse HEAD^2 >second-parent &&
+ git rev-parse HEAD^{tree} >tree &&
+ git update-index --refresh &&
+ git diff --exit-code &&
+ git diff --exit-code c3 HEAD &&
+ git diff --exit-code c3 &&
+
+ ! test_cmp head.old head &&
+ test_cmp head.old first-parent &&
+ test_cmp second-parent.expected second-parent &&
+ test_cmp tree.expected tree &&
+ test -f c0.c &&
+ ! test -e c1.c &&
+ test -f c3.c
+'
+
test_done