git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] t3903-stash: don't try to grep non-existing file
@ 2018-08-22 18:13 SZEDER Gábor
  2018-08-22 18:13 ` [PATCH 2/2] t3420-rebase-autostash: don't try to grep non-existing files SZEDER Gábor
  0 siblings, 1 reply; 2+ messages in thread
From: SZEDER Gábor @ 2018-08-22 18:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

The test 'store updates stash ref and reflog' in 't3903-stash.sh'
creates a stash from a new file, runs 'git reset --hard' to throw away
any modifications to the work tree, and then runs '! grep' to ensure
that the staged contents are gone.  Since the file didn't exist
before, it shouldn't exist after 'git reset' either.  Consequently,
this 'grep' doesn't fail as expected, because it can't find the staged
content, but it fails because it can't open the file.

Tighten this check by using 'test_path_is_missing' instead, thereby
avoiding an unexpected error from 'grep' as well.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/t3903-stash.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 1f871d3cca..6450bc6698 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -724,7 +724,7 @@ test_expect_success 'store updates stash ref and reflog' '
 	git add bazzy &&
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
-	! grep quux bazzy &&
+	test_path_is_missing bazzy &&
 	git stash store -m quuxery $STASH_ID &&
 	test $(git rev-parse stash) = $STASH_ID &&
 	git reflog --format=%H stash| grep $STASH_ID &&
-- 
2.19.0.rc0.136.gd2dd172e64


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] t3420-rebase-autostash: don't try to grep non-existing files
  2018-08-22 18:13 [PATCH 1/2] t3903-stash: don't try to grep non-existing file SZEDER Gábor
@ 2018-08-22 18:13 ` SZEDER Gábor
  0 siblings, 0 replies; 2+ messages in thread
From: SZEDER Gábor @ 2018-08-22 18:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

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>
---
 t/t3420-rebase-autostash.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index e243700660..0c4eefec76 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -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 &&
-- 
2.19.0.rc0.136.gd2dd172e64


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-22 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22 18:13 [PATCH 1/2] t3903-stash: don't try to grep non-existing file SZEDER Gábor
2018-08-22 18:13 ` [PATCH 2/2] t3420-rebase-autostash: don't try to grep non-existing files SZEDER Gábor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).