t3903: make drop stash test ref backend agnostic

In this test, the calls to cut(1) are only used to verify that the
contents of the reflog entry look as expected. By replacing these with
git-reflog(1) calls, we can make this test ref-backend agnostic.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
John Cai 2024-01-19 20:18:58 +00:00 committed by Junio C Hamano
parent dfc9486cb7
commit 99a294bcdb

View file

@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '
test_cmp expect actual
'
test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '
test_expect_success 'drop stash reflog updates refs/stash with rewrite' '
git init repo &&
(
cd repo &&
@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'
new_oid="$(git -C repo rev-parse stash@{0})" &&
cat >expect <<-EOF &&
$(test_oid zero) $old_oid
$old_oid $new_oid
$new_oid
$old_oid
EOF
cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
git -C repo reflog show refs/stash --format=%H >actual &&
test_cmp expect actual &&
git -C repo stash drop stash@{1} &&
cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
git -C repo reflog show refs/stash --format=%H >actual &&
cat >expect <<-EOF &&
$(test_oid zero) $new_oid
$new_oid
EOF
test_cmp expect actual
'