MCPcopy
hub / github.com/go-git/go-git / TestResetSparsely

Method TestResetSparsely

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

Source from the content-addressed store, hash-verified

1421}
1422
1423func (s *WorktreeSuite) TestResetSparsely(c *C) {
1424 fs := memfs.New()
1425 w := &Worktree{
1426 r: s.Repository,
1427 Filesystem: fs,
1428 }
1429
1430 sparseResetDirs := []string{"php"}
1431
1432 err := w.ResetSparsely(&ResetOptions{Mode: HardReset}, sparseResetDirs)
1433 c.Assert(err, IsNil)
1434
1435 files, err := fs.ReadDir("/")
1436 c.Assert(err, IsNil)
1437 c.Assert(files, HasLen, 1)
1438 c.Assert(files[0].Name(), Equals, "php")
1439
1440 files, err = fs.ReadDir("/php")
1441 c.Assert(err, IsNil)
1442 c.Assert(files, HasLen, 1)
1443 c.Assert(files[0].Name(), Equals, "crappy.php")
1444}
1445
1446func (s *WorktreeSuite) TestStatusAfterCheckout(c *C) {
1447 fs := memfs.New()

Callers

nothing calls this directly

Calls 3

ResetSparselyMethod · 0.95
NameMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected