Re: [PATCH 06/11] t: convert tests to not access reflog via the filesystem
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 21, 2023, 23:13 UTC
- Message-ID
- <xmqqy1fvsh6q.fsf@gitster.g>
- In-Reply-To
- <eaac658bbfd8259ed9a3cce6ca3c8486d6682e8f.1697607222.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 22 quoted lines
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh > index 5f505e2f353..b1d2c014132 100755 > --- a/t/t1400-update-ref.sh > +++ b/t/t1400-update-ref.sh > @@ -90,7 +90,8 @@ test_expect_success "deleting current branch adds message to HEAD's log" ' > git symbolic-ref HEAD $m && > git update-ref -m delete-$m -d $m && > test_must_fail git show-ref --verify -q $m && > - grep "delete-$m$" .git/logs/HEAD > + test-tool ref-store main for-each-reflog-ent HEAD >actual && > + grep "delete-$m$" actual > ' > > test_expect_success "deleting by HEAD adds message to HEAD's log" ' > @@ -99,7 +100,8 @@ test_expect_success "deleting by HEAD adds message to HEAD's log" ' > git symbolic-ref HEAD $m && > git update-ref -m delete-by-head -d HEAD && > test_must_fail git show-ref --verify -q $m && > - grep "delete-by-head$" .git/logs/HEAD > + test-tool ref-store main for-each-reflog-ent HEAD >actual && > + grep "delete-by-head$" actual > '
These are quite straight-forward.
Show 6 quoted lines
> test_expect_success "verifying $m's log (logged by config)" ' > - test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && > + test_when_finished "git update-ref -d $m && git reflog expire --expire=all --all && rm -rf actual expect" && > test-tool ref-store main for-each-reflog-ent $m >actual && > test_cmp actual expect > '
The approach forces us to assume that "git reflog expire" performs correctly in order to test reflog, but it probably is OK---we'll notice breakages in "reflog expire" in other tests, hopefully.