{"thread":{"id":"56678","subject":"[PATCH] t3420-rebase-autostash: don't try to grep non-existing files","startedAt":"2021-10-10T17:28:21Z","lastAt":"2026-06-28T01:45:32Z","messageCount":5,"participants":["SZEDER Gábor","Phillip Wood","Todd Zullinger","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"438426","messageId":"20211010172809.1472914-1-szeder.dev@gmail.com","threadId":"56678","inReplyTo":null,"subject":"[PATCH] t3420-rebase-autostash: don't try to grep non-existing files","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2021-10-10T17:28:09Z","receivedAt":"2021-10-10T17:28:21Z","isPatch":true,"body":"Several tests in 't3420-rebase-autostash.sh' start various rebase\nprocesses that are expected to fail because of merge conflicts.  The\ntests [1] checking that 'git rebase --quit' and autostash work\ntogether as expected after such a failure then run '! grep ...' to\nensure that the dirty contents of the file is gone.  However, due to\nthe test repo's history and the choice of upstream branch that file\nshouldn't exist in the conflicted state at all, and thus it shouldn't\nexist after the subsequent 'git rebase --quit' either.  Consequently,\nthis 'grep' doesn't fail as expected, i.e. because it can't find the\ndirty content, but instead it fails, because it can't open the file.\n\nThighten this check by using 'test_path_is_missing' instead, thereby\navoiding unexpected errors from 'grep' as well.\n\nPreviously 2745817028 (t3420-rebase-autostash: don't try to grep\nnon-existing files, 2018-08-22) fixed a couple of similar issues; this\none was added later in 9b2df3e8d0 (rebase: save autostash entry into\nstash reflog on --quit, 2020-04-28).\n\n[1] This patch modifies only a single test, but that test is run\n    several times with different strategies ('--apply', '--merge', and\n    '--interactive'), hence the plural \"tests\".\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n t/t3420-rebase-autostash.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex 43fcb68f27..bbe82d2c0c 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -200,7 +200,7 @@ testrebase () {\n \t\tgit rebase --quit &&\n \t\ttest_when_finished git stash drop &&\n \t\ttest_path_is_missing $dotest/autostash &&\n-\t\t! grep dirty file3 &&\n+\t\ttest_path_is_missing file3 &&\n \t\tgit stash show -p >actual &&\n \t\ttest_cmp expect actual &&\n \t\tgit reset --hard &&\n-- \n2.33.0.1279.g1a260bf8c2\n\n"},{"id":"546529","messageId":"aj90x3DsER5HASUS@szeder.dev","threadId":"56678","inReplyTo":"20211010172809.1472914-1-szeder.dev@gmail.com","subject":"Re: [PATCH] t3420-rebase-autostash: don't try to grep non-existing files","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2026-06-27T06:59:19Z","receivedAt":"2026-06-27T06:59:22Z","isPatch":true,"body":"On Sun, Oct 10, 2021 at 07:28:09PM +0200, SZEDER Gábor wrote:\n> Several tests in 't3420-rebase-autostash.sh' start various rebase\n> processes that are expected to fail because of merge conflicts.  The\n> tests [1] checking that 'git rebase --quit' and autostash work\n> together as expected after such a failure then run '! grep ...' to\n> ensure that the dirty contents of the file is gone.  However, due to\n> the test repo's history and the choice of upstream branch that file\n> shouldn't exist in the conflicted state at all, and thus it shouldn't\n> exist after the subsequent 'git rebase --quit' either.  Consequently,\n> this 'grep' doesn't fail as expected, i.e. because it can't find the\n> dirty content, but instead it fails, because it can't open the file.\n> \n> Thighten this check by using 'test_path_is_missing' instead, thereby\n> avoiding unexpected errors from 'grep' as well.\n> \n> Previously 2745817028 (t3420-rebase-autostash: don't try to grep\n> non-existing files, 2018-08-22) fixed a couple of similar issues; this\n> one was added later in 9b2df3e8d0 (rebase: save autostash entry into\n> stash reflog on --quit, 2020-04-28).\n> \n> [1] This patch modifies only a single test, but that test is run\n>     several times with different strategies ('--apply', '--merge', and\n>     '--interactive'), hence the plural \"tests\".\n> \n> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n> ---\n>  t/t3420-rebase-autostash.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n> index 43fcb68f27..bbe82d2c0c 100755\n> --- a/t/t3420-rebase-autostash.sh\n> +++ b/t/t3420-rebase-autostash.sh\n> @@ -200,7 +200,7 @@ testrebase () {\n>  \t\tgit rebase --quit &&\n>  \t\ttest_when_finished git stash drop &&\n>  \t\ttest_path_is_missing $dotest/autostash &&\n> -\t\t! grep dirty file3 &&\n> +\t\ttest_path_is_missing file3 &&\n>  \t\tgit stash show -p >actual &&\n>  \t\ttest_cmp expect actual &&\n>  \t\tgit reset --hard &&\n> -- \n> 2.33.0.1279.g1a260bf8c2\n\nIt appears that this patch might have fallen quite deep through the\ncracks... ;)\n\nBut the issue this patch is addressing is still there, and the patch\nstill applies cleanly after almost 5 years.\n"},{"id":"546531","messageId":"790bfda2-30f0-4629-9416-8324b29f68d2@gmail.com","threadId":"56678","inReplyTo":"aj90x3DsER5HASUS@szeder.dev","subject":"Re: [PATCH] t3420-rebase-autostash: don't try to grep non-existing files","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-06-27T09:03:13Z","receivedAt":"2026-06-27T09:03:17Z","isPatch":true,"body":"On 27/06/2026 07:59, SZEDER Gábor wrote:\n> On Sun, Oct 10, 2021 at 07:28:09PM +0200, SZEDER Gábor wrote:\n>> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n>> index 43fcb68f27..bbe82d2c0c 100755\n>> --- a/t/t3420-rebase-autostash.sh\n>> +++ b/t/t3420-rebase-autostash.sh\n>> @@ -200,7 +200,7 @@ testrebase () {\n\nWith an extra context line we see\n\n\t\ttest_path_is_missing file3 &&>>   \t\tgit rebase --quit &&\n>>   \t\ttest_when_finished git stash drop &&\n>>   \t\ttest_path_is_missing $dotest/autostash &&\n>> -\t\t! grep dirty file3 &&\n>> +\t\ttest_path_is_missing file3 &&\n\nand so it is quite clear that this change is correct\n\nThanks\n\nPhillip\n\n>>   \t\tgit stash show -p >actual &&\n>>   \t\ttest_cmp expect actual &&\n>>   \t\tgit reset --hard &&\n>> -- \n>> 2.33.0.1279.g1a260bf8c2\n> \n> It appears that this patch might have fallen quite deep through the\n> cracks... ;)\n> \n> But the issue this patch is addressing is still there, and the patch\n> still applies cleanly after almost 5 years.\n> \n\n"},{"id":"546538","messageId":"20260627142728.0BU3FFok@teonanacatl.net","threadId":"56678","inReplyTo":"aj90x3DsER5HASUS@szeder.dev","subject":"Re: [PATCH] t3420-rebase-autostash: don't try to grep non-existing files","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2026-06-27T14:27:28Z","receivedAt":"2026-06-27T14:27:30Z","isPatch":true,"body":"SZEDER Gábor wrote:\n> On Sun, Oct 10, 2021 at 07:28:09PM +0200, SZEDER Gábor wrote:\n>> Several tests in 't3420-rebase-autostash.sh' start various rebase\n>> processes that are expected to fail because of merge conflicts.  The\n>> tests [1] checking that 'git rebase --quit' and autostash work\n>> together as expected after such a failure then run '! grep ...' to\n>> ensure that the dirty contents of the file is gone.  However, due to\n>> the test repo's history and the choice of upstream branch that file\n>> shouldn't exist in the conflicted state at all, and thus it shouldn't\n>> exist after the subsequent 'git rebase --quit' either.  Consequently,\n>> this 'grep' doesn't fail as expected, i.e. because it can't find the\n>> dirty content, but instead it fails, because it can't open the file.\n>> \n>> Thighten this check by using 'test_path_is_missing' instead, thereby\n>> avoiding unexpected errors from 'grep' as well.\n\nThighten -> Tighten\n\n-- \nTodd\n"},{"id":"546575","messageId":"xmqqcxxb4eva.fsf@gitster.g","threadId":"56678","inReplyTo":"aj90x3DsER5HASUS@szeder.dev","subject":"Re: [PATCH] t3420-rebase-autostash: don't try to grep non-existing files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-28T01:45:29Z","receivedAt":"2026-06-28T01:45:32Z","isPatch":true,"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> On Sun, Oct 10, 2021 at 07:28:09PM +0200, SZEDER Gábor wrote:\n>> Several tests in 't3420-rebase-autostash.sh' start various rebase\n>> processes that are expected to fail because of merge conflicts.  The\n>> tests [1] checking that 'git rebase --quit' and autostash work\n>> together as expected after such a failure then run '! grep ...' to\n>> ensure that the dirty contents of the file is gone.  However, due to\n>> the test repo's history and the choice of upstream branch that file\n>> shouldn't exist in the conflicted state at all, and thus it shouldn't\n>> exist after the subsequent 'git rebase --quit' either.  Consequently,\n>> this 'grep' doesn't fail as expected, i.e. because it can't find the\n>> dirty content, but instead it fails, because it can't open the file.\n>> \n>> Thighten this check by using 'test_path_is_missing' instead, thereby\n>> avoiding unexpected errors from 'grep' as well.\n>> \n>> Previously 2745817028 (t3420-rebase-autostash: don't try to grep\n>> non-existing files, 2018-08-22) fixed a couple of similar issues; this\n>> one was added later in 9b2df3e8d0 (rebase: save autostash entry into\n>> stash reflog on --quit, 2020-04-28).\n>> \n>> [1] This patch modifies only a single test, but that test is run\n>>     several times with different strategies ('--apply', '--merge', and\n>>     '--interactive'), hence the plural \"tests\".\n>> \n>> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n>> ---\n>>  t/t3420-rebase-autostash.sh | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>> \n>> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n>> index 43fcb68f27..bbe82d2c0c 100755\n>> --- a/t/t3420-rebase-autostash.sh\n>> +++ b/t/t3420-rebase-autostash.sh\n>> @@ -200,7 +200,7 @@ testrebase () {\n>>  \t\tgit rebase --quit &&\n>>  \t\ttest_when_finished git stash drop &&\n>>  \t\ttest_path_is_missing $dotest/autostash &&\n>> -\t\t! grep dirty file3 &&\n>> +\t\ttest_path_is_missing file3 &&\n>>  \t\tgit stash show -p >actual &&\n>>  \t\ttest_cmp expect actual &&\n>>  \t\tgit reset --hard &&\n>> -- \n>> 2.33.0.1279.g1a260bf8c2\n>\n> It appears that this patch might have fallen quite deep through the\n> cracks... ;)\n\nYeah, that indeed seems to be the case.  It is surprising that\nnobody even had any comment on it back then.\n\n> But the issue this patch is addressing is still there, and the patch\n> still applies cleanly after almost 5 years.\n\nWill take a look and queue.  Thanks.\n"}]}