]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3420-rebase-autostash: don't try to grep non-existing files
authorSZEDER Gábor <szeder.dev@gmail.com>
Wed, 22 Aug 2018 18:13:20 +0000 (20:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Aug 2018 18:52:51 +0000 (11:52 -0700)
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>
t/t3420-rebase-autostash.sh

index e24370066012fcb441aa0c59ff9c0c34e1d37e9c..0c4eefec760efaa238c1718ac7353e14a6e95344 100755 (executable)
@@ -202,7 +202,7 @@ testrebase () {
                echo dirty >>file3 &&
                test_must_fail git rebase$type related-onto-branch &&
                test_path_is_file $dotest/autostash &&
-               ! grep dirty file3 &&
+               test_path_is_missing file3 &&
                rm -rf $dotest &&
                git reset --hard &&
                git checkout feature-branch
@@ -216,7 +216,7 @@ testrebase () {
                echo dirty >>file3 &&
                test_must_fail git rebase$type related-onto-branch &&
                test_path_is_file $dotest/autostash &&
-               ! grep dirty file3 &&
+               test_path_is_missing file3 &&
                echo "conflicting-plus-goodbye" >file2 &&
                git add file2 &&
                git rebase --continue &&
@@ -233,7 +233,7 @@ testrebase () {
                echo dirty >>file3 &&
                test_must_fail git rebase$type related-onto-branch &&
                test_path_is_file $dotest/autostash &&
-               ! grep dirty file3 &&
+               test_path_is_missing file3 &&
                git rebase --skip &&
                test_path_is_missing $dotest/autostash &&
                grep dirty file3 &&
@@ -248,7 +248,7 @@ testrebase () {
                echo dirty >>file3 &&
                test_must_fail git rebase$type related-onto-branch &&
                test_path_is_file $dotest/autostash &&
-               ! grep dirty file3 &&
+               test_path_is_missing file3 &&
                git rebase --abort &&
                test_path_is_missing $dotest/autostash &&
                grep dirty file3 &&