Merge branch 'sg/reflog-past-root'

"git reflog" stopped upon seeing an entry that denotes a branch
creation event (aka "unborn"), which made it appear as if the
reflog was truncated.

* sg/reflog-past-root:
  reflog: continue walking the reflog past root commits
This commit is contained in:
Junio C Hamano
2016-06-27 09:56:46 -07:00
3 changed files with 29 additions and 1 deletions

View File

@ -110,7 +110,7 @@ test_expect_success 'symbolic-ref writes reflog entry' '
update
create
EOF
git log --format=%gs -g >actual &&
git log --format=%gs -g -2 >actual &&
test_cmp expect actual
'

View File

@ -348,4 +348,26 @@ test_expect_success 'reflog expire operates on symref not referrent' '
git reflog expire --expire=all the_symref
'
test_expect_success 'continue walking past root commits' '
git init orphanage &&
(
cd orphanage &&
cat >expect <<-\EOF &&
HEAD@{0} commit (initial): orphan2-1
HEAD@{1} commit: orphan1-2
HEAD@{2} commit (initial): orphan1-1
HEAD@{3} commit (initial): initial
EOF
test_commit initial &&
git reflog &&
git checkout --orphan orphan1 &&
test_commit orphan1-1 &&
test_commit orphan1-2 &&
git checkout --orphan orphan2 &&
test_commit orphan2-1 &&
git log -g --format="%gd %gs" >actual &&
test_cmp expect actual
)
'
test_done