| 913 | } |
| 914 | |
| 915 | func (s *WorktreeSuite) TestCheckoutCreateInvalidBranch(c *C) { |
| 916 | w := &Worktree{ |
| 917 | r: s.Repository, |
| 918 | Filesystem: memfs.New(), |
| 919 | } |
| 920 | |
| 921 | for _, name := range []plumbing.ReferenceName{ |
| 922 | "foo", |
| 923 | "-", |
| 924 | "-foo", |
| 925 | "refs/heads//", |
| 926 | "refs/heads/..", |
| 927 | "refs/heads/a..b", |
| 928 | "refs/heads/.", |
| 929 | } { |
| 930 | err := w.Checkout(&CheckoutOptions{ |
| 931 | Create: true, |
| 932 | Branch: name, |
| 933 | }) |
| 934 | |
| 935 | c.Assert(err, Equals, plumbing.ErrInvalidReferenceName) |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | func (s *WorktreeSuite) TestCheckoutTag(c *C) { |
| 940 | f := fixtures.ByTag("tags").One() |