]> git.ipfire.org Git - thirdparty/git.git/commit
t3420-rebase-autostash: don't try to grep non-existing files
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 10 Oct 2021 17:28:09 +0000 (19:28 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Jun 2026 01:47:02 +0000 (18:47 -0700)
commiteaad121fefb3c5845a52aba8952435096a172154
tree806f0aa619ac2229252be6d387e4c779fcb780dc
parent225bc32a989d7a22fa6addafd4ce7dcd04675dbf
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.  The
tests [1] checking that 'git rebase --quit' and autostash work
together as expected after such a failure then run '! grep ...' to
ensure that the dirty contents of the 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, and thus it shouldn't
exist after the subsequent 'git rebase --quit' either.  Consequently,
this 'grep' doesn't fail as expected, i.e. because it can't find the
dirty content, but instead it fails, because it can't open the file.

Thighten this check by using 'test_path_is_missing' instead, thereby
avoiding unexpected errors from 'grep' as well.

Previously 2745817028 (t3420-rebase-autostash: don't try to grep
non-existing files, 2018-08-22) fixed a couple of similar issues; this
one was added later in 9b2df3e8d0 (rebase: save autostash entry into
stash reflog on --quit, 2020-04-28).

[1] This patch modifies only a single test, but that test is run
    several times with different strategies ('--apply', '--merge', and
    '--interactive'), hence the plural "tests".

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3420-rebase-autostash.sh