]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4069-remerge-diff.sh
show, log: provide a --remerge-diff capability
[thirdparty/git.git] / t / t4069-remerge-diff.sh
CommitLineData
db757e8b
EN
1#!/bin/sh
2
3test_description='remerge-diff handling'
4
5. ./test-lib.sh
6
7# This test is ort-specific
8if test "${GIT_TEST_MERGE_ALGORITHM}" != ort
9then
10 skip_all="GIT_TEST_MERGE_ALGORITHM != ort"
11 test_done
12fi
13
14test_expect_success 'setup basic merges' '
15 test_write_lines 1 2 3 4 5 6 7 8 9 >numbers &&
16 git add numbers &&
17 git commit -m base &&
18
19 git branch feature_a &&
20 git branch feature_b &&
21 git branch feature_c &&
22
23 git branch ab_resolution &&
24 git branch bc_resolution &&
25
26 git checkout feature_a &&
27 test_write_lines 1 2 three 4 5 6 7 eight 9 >numbers &&
28 git commit -a -m change_a &&
29
30 git checkout feature_b &&
31 test_write_lines 1 2 tres 4 5 6 7 8 9 >numbers &&
32 git commit -a -m change_b &&
33
34 git checkout feature_c &&
35 test_write_lines 1 2 3 4 5 6 7 8 9 10 >numbers &&
36 git commit -a -m change_c &&
37
38 git checkout bc_resolution &&
39 git merge --ff-only feature_b &&
40 # no conflict
41 git merge feature_c &&
42
43 git checkout ab_resolution &&
44 git merge --ff-only feature_a &&
45 # conflicts!
46 test_must_fail git merge feature_b &&
47 # Resolve conflict...and make another change elsewhere
48 test_write_lines 1 2 drei 4 5 6 7 acht 9 >numbers &&
49 git add numbers &&
50 git merge --continue
51'
52
53test_expect_success 'remerge-diff on a clean merge' '
54 git log -1 --oneline bc_resolution >expect &&
55 git show --oneline --remerge-diff bc_resolution >actual &&
56 test_cmp expect actual
57'
58
59test_expect_success 'remerge-diff with both a resolved conflict and an unrelated change' '
60 git log -1 --oneline ab_resolution >tmp &&
61 cat <<-EOF >>tmp &&
62 diff --git a/numbers b/numbers
63 index a1fb731..6875544 100644
64 --- a/numbers
65 +++ b/numbers
66 @@ -1,13 +1,9 @@
67 1
68 2
69 -<<<<<<< b0ed5cb (change_a)
70 -three
71 -=======
72 -tres
73 ->>>>>>> 6cd3f82 (change_b)
74 +drei
75 4
76 5
77 6
78 7
79 -eight
80 +acht
81 9
82 EOF
83 # Hashes above are sha1; rip them out so test works with sha256
84 sed -e "s/[0-9a-f]\{7,\}/HASH/g" tmp >expect &&
85
86 git show --oneline --remerge-diff ab_resolution >tmp &&
87 sed -e "s/[0-9a-f]\{7,\}/HASH/g" tmp >actual &&
88 test_cmp expect actual
89'
90
91test_done