t3420-rebase-autostash: don't try to grep non-existing files
Several tests in 't3420-rebase-autostash.sh' start various rebase processes that are expected to fail because of merge conflicts. These tests then run '! grep' to ensure that the autostash feature did its job, and the dirty contents of a file is gone. However, due to the test repo's history and the choice of upstream branch that file shouldn't exist in the conflicted state at all. Consequently, this 'grep' doesn't fail as expected, because it can't find the dirty content, but it fails because it can't open the file. Tighten this check by using 'test_path_is_missing' instead, thereby avoiding unexpected errors from 'grep' as well. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Aug 22, 2018 at 20:13 UTC
2745817028f6fc7502f295fd3694176778cecf54
1 file changed
+4
-4
t/t3420-rebase-autostash.sh
+4
-4
@@ -202,7 +202,7 @@ testrebase () {
202
echo dirty >>file3 &&
203
test_must_fail git rebase$type related-onto-branch &&
204
test_path_is_file $dotest/autostash &&
205
- ! grep dirty file3 &&
205
+ test_path_is_missing file3 &&
206
rm -rf $dotest &&
207
git reset --hard &&
208
git checkout feature-branch
@@ -216,7 +216,7 @@ testrebase () {
216
echo dirty >>file3 &&
217
test_must_fail git rebase$type related-onto-branch &&
218
test_path_is_file $dotest/autostash &&
219
- ! grep dirty file3 &&
219
+ test_path_is_missing file3 &&
220
echo "conflicting-plus-goodbye" >file2 &&
221
git add file2 &&
222
git rebase --continue &&
@@ -233,7 +233,7 @@ testrebase () {
233
echo dirty >>file3 &&
234
test_must_fail git rebase$type related-onto-branch &&
235
test_path_is_file $dotest/autostash &&
236
- ! grep dirty file3 &&
236
+ test_path_is_missing file3 &&
237
git rebase --skip &&
238
test_path_is_missing $dotest/autostash &&
239
grep dirty file3 &&
@@ -248,7 +248,7 @@ testrebase () {
248
echo dirty >>file3 &&
249
test_must_fail git rebase$type related-onto-branch &&
250
test_path_is_file $dotest/autostash &&
251
- ! grep dirty file3 &&
251
+ test_path_is_missing file3 &&
252
git rebase --abort &&
253
test_path_is_missing $dotest/autostash &&
254
grep dirty file3 &&