git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] t3903-stash: don't try to grep non-existing file

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 22, 2018, 18:13 UTC
Message-ID
<20180822181320.14055-1-szeder.dev@gmail.com>

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
Next: SZEDER Gábor
Message 1 of 2 in “t3903-stash: don't try to grep non-existing file”
  1. 1/2 t3903-stash: don't try to grep non-existing fileSZEDER Gábor, Aug 22, 2018
  2. 2/2 t3420-rebase-autostash: don't try to grep non-existing filesSZEDER Gábor, Aug 22, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.