@matheusbsbs / matheus-bagliano / commits / 4bd03d15e4
Fork 0

Simplify t3410

Use test_commit() and test_merge(), reducing the code while making the intent clearer. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 27, 2009 at 23:34 UTC 4bd03d15e495086a38470b59447296db4c235cb9
1 file changed +35 -89
t/t3410-rebase-preserve-dropped-merges.sh
+35 -89
@@ -22,47 +22,17 @@ rewritten.
22 # where B, D and G touch the same file.
23
24 test_expect_success 'setup' '
25 - : > file1 &&
26 - git add file1 &&
27 - test_tick &&
28 - git commit -m A &&
29 - git tag A &&
30 - echo 1 > file1 &&
31 - test_tick &&
32 - git commit -m B file1 &&
33 - : > file2 &&
34 - git add file2 &&
35 - test_tick &&
36 - git commit -m C &&
37 - echo 2 > file1 &&
38 - test_tick &&
39 - git commit -m D file1 &&
40 - : > file3 &&
41 - git add file3 &&
42 - test_tick &&
43 - git commit -m E &&
44 - git tag E &&
45 - git checkout -b branch1 A &&
46 - : > file4 &&
47 - git add file4 &&
48 - test_tick &&
49 - git commit -m F &&
50 - git tag F &&
51 - echo 3 > file1 &&
52 - test_tick &&
53 - git commit -m G file1 &&
54 - git tag G &&
55 - : > file5 &&
56 - git add file5 &&
57 - test_tick &&
58 - git commit -m H &&
59 - git tag H &&
60 - git checkout -b branch2 F &&
61 - : > file6 &&
62 - git add file6 &&
63 - test_tick &&
64 - git commit -m I &&
65 - git tag I
25 + test_commit A file1 &&
26 + test_commit B file1 1 &&
27 + test_commit C file2 &&
28 + test_commit D file1 2 &&
29 + test_commit E file3 &&
30 + git checkout A &&
31 + test_commit F file4 &&
32 + test_commit G file1 3 &&
33 + test_commit H file5 &&
34 + git checkout F &&
35 + test_commit I file6
36 '
37
38 # A - B - C - D - E
@@ -72,68 +42,44 @@ test_expect_success 'setup' '
42 # I -- G2 -- J -- K I -- K
43 # G2 = same changes as G
44 test_expect_success 'skip same-resolution merges with -p' '
75 - git checkout branch1 &&
45 + git checkout H &&
46 ! git merge E &&
77 - echo 23 > file1 &&
78 - git add file1 &&
79 - git commit -m L &&
80 - git checkout branch2 &&
81 - echo 3 > file1 &&
82 - git commit -a -m G2 &&
47 + test_commit L file1 23 &&
48 + git checkout I &&
49 + test_commit G2 file1 3 &&
50 ! git merge E &&
84 - echo 23 > file1 &&
85 - git add file1 &&
86 - git commit -m J &&
87 - echo file7 > file7 &&
88 - git add file7 &&
89 - git commit -m K &&
90 - GIT_EDITOR=: git rebase -i -p branch1 &&
91 - test $(git rev-parse branch2^^) = $(git rev-parse branch1) &&
51 + test_commit J file1 23 &&
52 + test_commit K file7 file7 &&
53 + git rebase -i -p L &&
54 + test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
55 test "23" = "$(cat file1)" &&
93 - test "" = "$(cat file6)" &&
94 - test "file7" = "$(cat file7)" &&
95 -
96 - git checkout branch1 &&
97 - git reset --hard H &&
98 - git checkout branch2 &&
99 - git reset --hard I
56 + test "I" = "$(cat file6)" &&
57 + test "file7" = "$(cat file7)"
58 '
59
60 # A - B - C - D - E
61 # \ \ \
104 -# F - G - H -- L \ --> L
105 -# \ | \
106 -# I -- G2 -- J -- K I -- G2 -- K
62 +# F - G - H -- L2 \ --> L2
63 +# \ | \
64 +# I -- G3 --- J2 -- K2 I -- G3 -- K2
65 # G2 = different changes as G
66 test_expect_success 'keep different-resolution merges with -p' '
109 - git checkout branch1 &&
67 + git checkout H &&
68 ! git merge E &&
111 - echo 23 > file1 &&
112 - git add file1 &&
113 - git commit -m L &&
114 - git checkout branch2 &&
115 - echo 4 > file1 &&
116 - git commit -a -m G2 &&
69 + test_commit L2 file1 23 &&
70 + git checkout I &&
71 + test_commit G3 file1 4 &&
72 ! git merge E &&
118 - echo 24 > file1 &&
119 - git add file1 &&
120 - git commit -m J &&
121 - echo file7 > file7 &&
122 - git add file7 &&
123 - git commit -m K &&
124 - ! GIT_EDITOR=: git rebase -i -p branch1 &&
73 + test_commit J2 file1 24 &&
74 + test_commit K2 file7 file7 &&
75 + test_must_fail git rebase -i -p L2 &&
76 echo 234 > file1 &&
77 git add file1 &&
127 - GIT_EDITOR=: git rebase --continue &&
128 - test $(git rev-parse branch2^^^) = $(git rev-parse branch1) &&
78 + git rebase --continue &&
79 + test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
80 test "234" = "$(cat file1)" &&
130 - test "" = "$(cat file6)" &&
131 - test "file7" = "$(cat file7)" &&
132 -
133 - git checkout branch1 &&
134 - git reset --hard H &&
135 - git checkout branch2 &&
136 - git reset --hard I
81 + test "I" = "$(cat file6)" &&
82 + test "file7" = "$(cat file7)"
83 '
84
85 test_done