3 test_description
='git reflog --updateref'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
9 git init -b main repo &&
17 cp .git/logs/HEAD HEAD.old &&
18 git reset --hard HEAD~ &&
19 cp HEAD.old .git/logs/HEAD
23 test_reflog_updateref
() {
28 test_expect_success REFFILES
"get '$exp' with '$args'" '
29 test_when_finished "rm -rf copy" &&
36 git rev-parse $exp >expect &&
37 git rev-parse HEAD >actual &&
39 test_cmp expect actual
44 test_reflog_updateref B git reflog delete
--updateref HEAD@
{0}
45 test_reflog_updateref B git reflog delete
--updateref HEAD@
{1}
46 test_reflog_updateref C git reflog delete
--updateref main@
{0}
47 test_reflog_updateref B git reflog delete
--updateref main@
{1}
48 test_reflog_updateref B git reflog delete
--updateref --rewrite HEAD@
{0}
49 test_reflog_updateref B git reflog delete
--updateref --rewrite HEAD@
{1}
50 test_reflog_updateref C git reflog delete
--updateref --rewrite main@
{0}
51 test_reflog_updateref B git reflog delete
--updateref --rewrite main@
{1}
52 test_reflog_updateref B test_must_fail git reflog expire HEAD@
{0}
53 test_reflog_updateref B test_must_fail git reflog expire HEAD@
{1}
54 test_reflog_updateref B test_must_fail git reflog expire main@
{0}
55 test_reflog_updateref B test_must_fail git reflog expire main@
{1}
56 test_reflog_updateref B test_must_fail git reflog expire
--updateref HEAD@
{0}
57 test_reflog_updateref B test_must_fail git reflog expire
--updateref HEAD@
{1}
58 test_reflog_updateref B test_must_fail git reflog expire
--updateref main@
{0}
59 test_reflog_updateref B test_must_fail git reflog expire
--updateref main@
{1}
60 test_reflog_updateref B test_must_fail git reflog expire
--updateref --rewrite HEAD@
{0}
61 test_reflog_updateref B test_must_fail git reflog expire
--updateref --rewrite HEAD@
{1}
62 test_reflog_updateref B test_must_fail git reflog expire
--updateref --rewrite main@
{0}
63 test_reflog_updateref B test_must_fail git reflog expire
--updateref --rewrite main@
{1}