Merge branch 'sg/coccicheck-updates'
[gitweb.git] / t / t1410-reflog.sh
index c623824b4d0c2bfde08a69c242e4c5340b97abd3..8293131001ee0e816406df858dc47bc2fb9be3ce 100755 (executable)
@@ -338,4 +338,35 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '
        test_line_count = 3 actual
 '
 
+test_expect_success 'reflog expire operates on symref not referrent' '
+       git branch --create-reflog the_symref &&
+       git branch --create-reflog referrent &&
+       git update-ref referrent HEAD &&
+       git symbolic-ref refs/heads/the_symref refs/heads/referrent &&
+       test_when_finished "rm -f .git/refs/heads/referrent.lock" &&
+       touch .git/refs/heads/referrent.lock &&
+       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 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