| 826 | } |
| 827 | |
| 828 | func (s *WorktreeSuite) TestCheckoutCreateInvalidBranch(c *C) { |
| 829 | w := &Worktree{ |
| 830 | r: s.Repository, |
| 831 | Filesystem: memfs.New(), |
| 832 | } |
| 833 | |
| 834 | for _, name := range []plumbing.ReferenceName{ |
| 835 | "foo", |
| 836 | "-", |
| 837 | "-foo", |
| 838 | "refs/heads//", |
| 839 | "refs/heads/..", |
| 840 | "refs/heads/a..b", |
| 841 | "refs/heads/.", |
| 842 | } { |
| 843 | err := w.Checkout(&CheckoutOptions{ |
| 844 | Create: true, |
| 845 | Branch: name, |
| 846 | }) |
| 847 | |
| 848 | c.Assert(err, Equals, plumbing.ErrInvalidReferenceName) |
| 849 | } |
| 850 | } |
| 851 | |
| 852 | func (s *WorktreeSuite) TestCheckoutTag(c *C) { |
| 853 | f := fixtures.ByTag("tags").One() |