Skip to content

Commit f91b273

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3e4068e commit f91b273

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t1401-symbolic-ref.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,20 @@ test_expect_success 'symbolic-ref reports failure in exit code' '
6969
test_must_fail git symbolic-ref HEAD refs/heads/whatever
7070
'
7171

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+
7288
test_done

0 commit comments

Comments
 (0)