t/t3437: remove the dependency of 'expected-message' file from tests
As it is currently implemented, it's too difficult to follow along and remember the value of "expected-message" from test to test. It also makes it difficult to extend tests or add new tests in between existing tests without negatively impacting other tests. Let's set up "expected-message" to the precise content needed by the test, so that both the problems go away and also makes easier to run tests selectively with '--run' or 'GIT_SKIP_TESTS' Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charvi Mendiratta committed
Feb 10, 2021 at 17:06 UTC
733ad2e15a5f078543fb0a5a10ee8ae5419d318e
1 file changed
+3
-3
t/t3437-rebase-fixup-options.sh
+3
-3
@@ -46,8 +46,6 @@ test_expect_success 'setup' '
46
body
47
EOF
48
49
- sed "1,2d" message >expected-message &&
50
-
49
test_commit A A &&
50
test_commit B B &&
51
get_author HEAD >expected-author &&
@@ -134,6 +132,7 @@ test_expect_success 'simple fixup -c works' '
132
test_expect_success 'fixup -C removes amend! from message' '
133
test_when_finished "test_might_fail git rebase --abort" &&
134
git checkout --detach A1 &&
135
+ git log -1 --pretty=format:%b >expected-message &&
136
FAKE_LINES="1 fixup_-C 2" git rebase -i A &&
137
test_cmp_rev HEAD^ A &&
138
test_cmp_rev HEAD^{tree} A1^{tree} &&
@@ -145,13 +144,14 @@ test_expect_success 'fixup -C removes amend! from message' '
144
test_expect_success 'fixup -C with conflicts gives correct message' '
145
test_when_finished "test_might_fail git rebase --abort" &&
146
git checkout --detach A1 &&
147
+ git log -1 --pretty=format:%b >expected-message &&
148
+ test_write_lines "" "edited" >>expected-message &&
149
test_must_fail env FAKE_LINES="1 fixup_-C 2" git rebase -i conflicts &&
150
git checkout --theirs -- A &&
151
git add A &&
152
FAKE_COMMIT_AMEND=edited git rebase --continue &&
153
test_cmp_rev HEAD^ conflicts &&
154
test_cmp_rev HEAD^{tree} A1^{tree} &&
154
- test_write_lines "" edited >>expected-message &&
155
test_commit_message HEAD expected-message &&
156
get_author HEAD >actual-author &&
157
test_cmp expected-author actual-author