t1414: convert test to use Git commands instead of writing refs manually

This test can be re-written to use Git commands rather than writing a manual ref in the reflog. This way this test no longer needs the REFFILES prerequisite. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Cai committed Jan 19, 2024 at 20:18 UTC 9901af48ea98766afae4110641d208a278de11c5
1 file changed +5 -6
t/t1414-reflog-walk.sh
+5 -6
@@ -121,13 +121,12 @@ test_expect_success 'min/max age uses entry date to limit' '
121
122 # Create a situation where the reflog and ref database disagree about the latest
123 # state of HEAD.
124 -test_expect_success REFFILES 'walk prefers reflog to ref tip' '
124 +test_expect_success 'walk prefers reflog to ref tip' '
125 + test_commit A &&
126 + test_commit B &&
127 + git reflog delete HEAD@{0} &&
128 head=$(git rev-parse HEAD) &&
126 - one=$(git rev-parse one) &&
127 - ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
128 - echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD &&
129 -
130 - echo $one >expect &&
129 + git rev-parse A >expect &&
130 git log -g --format=%H -1 >actual &&
131 test_cmp expect actual
132 '