aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:08 -0700
committerJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:08 -0700
commitf545f401be93241cfefbeed3a25b63045c8fc3a7 (patch)
tree8c85ec40b35601f22327445d8017f573b4f964d6 /t
parent17d9dbd3c270aaa33487f6a03d128c47aea6b309 (diff)
parent29d7bf19512d8ca97be5cf708ca2e0bcc29408ab (diff)
downloadgit-f545f401be93241cfefbeed3a25b63045c8fc3a7.tar.xz
Merge branch 'en/merge-tree-check'
"git merge-tree" learned an option to see if it resolves cleanly without actually creating a result. * en/merge-tree-check: merge-tree: add a new --quiet flag merge-ort: add a new mergeability_only option
Diffstat (limited to 't')
-rwxr-xr-xt/t4301-merge-tree-write-tree.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh
index f9c5883a7f..6e117ee93c 100755
--- a/t/t4301-merge-tree-write-tree.sh
+++ b/t/t4301-merge-tree-write-tree.sh
@@ -54,6 +54,25 @@ test_expect_success setup '
git commit -m first-commit
'
+test_expect_success '--quiet on clean merge' '
+ # Get rid of loose objects to start with
+ git gc &&
+ echo "0 objects, 0 kilobytes" >expect &&
+ git count-objects >actual &&
+ test_cmp expect actual &&
+
+ # Ensure merge is successful (exit code of 0)
+ git merge-tree --write-tree --quiet side1 side3 >output &&
+
+ # Ensure there is no output
+ test_must_be_empty output &&
+
+ # Ensure no loose objects written (all new objects written would have
+ # been in "outer layer" of the merge)
+ git count-objects >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'Clean merge' '
TREE_OID=$(git merge-tree --write-tree side1 side3) &&
q_to_tab <<-EOF >expect &&
@@ -72,6 +91,25 @@ test_expect_success 'Failed merge without rename detection' '
grep "CONFLICT (modify/delete): numbers deleted" out
'
+test_expect_success '--quiet on conflicted merge' '
+ # Get rid of loose objects to start with
+ git gc &&
+ echo "0 objects, 0 kilobytes" >expect &&
+ git count-objects >actual &&
+ test_cmp expect actual &&
+
+ # Ensure merge has conflict
+ test_expect_code 1 git merge-tree --write-tree --quiet side1 side2 >output &&
+
+ # Ensure there is no output
+ test_must_be_empty output &&
+
+ # Ensure no loose objects written (all new objects written would have
+ # been in "outer layer" of the merge)
+ git count-objects >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'Content merge and a few conflicts' '
git checkout side1^0 &&
test_must_fail git merge side2 &&