t1401: test reflog creation for git-symbolic-ref

The current code writes a reflog entry whenever we update a symbolic ref, but we never test that this is so. Let's add a test to make sure upcoming refactoring doesn't cause a regression. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 20, 2015 at 02:27 UTC f91b2732b3df6bae21512af58e0cfccbd5301331
1 file changed +16
t/t1401-symbolic-ref.sh
+16
@@ -69,4 +69,20 @@ test_expect_success 'symbolic-ref reports failure in exit code' '
69 test_must_fail git symbolic-ref HEAD refs/heads/whatever
70 '
71
72 +test_expect_success 'symbolic-ref writes reflog entry' '
73 + git checkout -b log1 &&
74 + test_commit one &&
75 + git checkout -b log2 &&
76 + test_commit two &&
77 + git checkout --orphan orphan &&
78 + git symbolic-ref -m create HEAD refs/heads/log1 &&
79 + git symbolic-ref -m update HEAD refs/heads/log2 &&
80 + cat >expect <<-\EOF &&
81 + update
82 + create
83 + EOF
84 + git log --format=%gs -g >actual &&
85 + test_cmp expect actual
86 +'
87 +
88 test_done