MCPcopy Create free account
hub / github.com/go-git/go-git / TestCheckoutIndexOS

Method TestCheckoutIndexOS

worktree_test.go:706–734  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

704}
705
706func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) {
707 fs, clean := s.TemporalFilesystem()
708 defer clean()
709
710 w := &Worktree{
711 r: s.Repository,
712 Filesystem: fs,
713 }
714
715 err := w.Checkout(&CheckoutOptions{})
716 c.Assert(err, IsNil)
717
718 idx, err := s.Repository.Storer.Index()
719 c.Assert(err, IsNil)
720 c.Assert(idx.Entries, HasLen, 9)
721 c.Assert(idx.Entries[0].Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88")
722 c.Assert(idx.Entries[0].Name, Equals, ".gitignore")
723 c.Assert(idx.Entries[0].Mode, Equals, filemode.Regular)
724 c.Assert(idx.Entries[0].ModifiedAt.IsZero(), Equals, false)
725 c.Assert(idx.Entries[0].Size, Equals, uint32(189))
726
727 c.Assert(idx.Entries[0].CreatedAt.IsZero(), Equals, false)
728 if runtime.GOOS != "windows" {
729 c.Assert(idx.Entries[0].Dev, Not(Equals), uint32(0))
730 c.Assert(idx.Entries[0].Inode, Not(Equals), uint32(0))
731 c.Assert(idx.Entries[0].UID, Not(Equals), uint32(0))
732 c.Assert(idx.Entries[0].GID, Not(Equals), uint32(0))
733 }
734}
735
736func (s *WorktreeSuite) TestCheckoutBranch(c *C) {
737 w := &Worktree{

Callers

nothing calls this directly

Calls 5

CheckoutMethod · 0.95
IndexMethod · 0.65
StringMethod · 0.65
IsZeroMethod · 0.65
TemporalFilesystemMethod · 0.45

Tested by

no test coverage detected