On Wed, Jan 30, 2019 at 4:50 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh > @@ -0,0 +1,91 @@ > +test_expect_success 'switch and create branch' ' > + test_when_finished git switch master && > + git switch -c temp master^ && > + git rev-parse master^ >expected && > + git rev-parse refs/heads/temp >actual && > + test_cmp expected actual && The above three lines could be replaced with test_cmp_rev()? > + echo refs/heads/temp >expected-branch && > + git symbolic-ref HEAD >actual-branch && > + test_cmp expected-branch actual-branch > +' > + > +test_expect_success 'force create branch from HEAD' ' > + test_when_finished git switch master && > + git switch --detach master && > + git switch -C temp && > + git rev-parse master >expected && > + git rev-parse refs/heads/temp >actual && > + test_cmp expected actual && Ditto: test_cmp_rev() > + echo refs/heads/temp >expected-branch && > + git symbolic-ref HEAD >actual-branch && > + test_cmp expected-branch actual-branch > +'