blob: ff30874f940439fe979e3857400c54b944194dcb [file] [log] [blame]
Jeff Kingffa1eea2010-11-21 23:42:53 -05001#!/bin/sh
2
3test_description='reflog walk shows repeated commits again'
Ævar Arnfjörð Bjarmason81ffbf82022-04-13 22:01:52 +02004
5TEST_PASSES_SANITIZE_LEAK=true
Jeff Kingffa1eea2010-11-21 23:42:53 -05006. ./test-lib.sh
7
8test_expect_success 'setup commits' '
Ævar Arnfjörð Bjarmasonf5d79bf2021-01-12 21:18:00 +01009 test_commit one file content &&
10 test_commit --append two file content
Jeff Kingffa1eea2010-11-21 23:42:53 -050011'
12
13test_expect_success 'setup reflog with alternating commits' '
14 git checkout -b topic &&
15 git reset one &&
16 git reset two &&
17 git reset one &&
18 git reset two
19'
20
21test_expect_success 'reflog shows all entries' '
Ramkumar Ramachandra02380382011-12-08 18:40:17 +053022 cat >expect <<-\EOF &&
Jeff Kingd04520e2011-07-22 10:12:23 -060023 topic@{0} reset: moving to two
24 topic@{1} reset: moving to one
25 topic@{2} reset: moving to two
26 topic@{3} reset: moving to one
Jeff Kingffa1eea2010-11-21 23:42:53 -050027 topic@{4} branch: Created from HEAD
28 EOF
29 git log -g --format="%gd %gs" topic >actual &&
30 test_cmp expect actual
31'
32
33test_done