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

Method TestResetSoft

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

Source from the content-addressed store, hash-verified

1227}
1228
1229func (s *WorktreeSuite) TestResetSoft(c *C) {
1230 fs := memfs.New()
1231 w := &Worktree{
1232 r: s.Repository,
1233 Filesystem: fs,
1234 }
1235
1236 commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9")
1237
1238 err := w.Checkout(&CheckoutOptions{})
1239 c.Assert(err, IsNil)
1240
1241 err = w.Reset(&ResetOptions{Mode: SoftReset, Commit: commit})
1242 c.Assert(err, IsNil)
1243
1244 branch, err := w.r.Reference(plumbing.Master, false)
1245 c.Assert(err, IsNil)
1246 c.Assert(branch.Hash(), Equals, commit)
1247
1248 status, err := w.Status()
1249 c.Assert(err, IsNil)
1250 c.Assert(status.IsClean(), Equals, false)
1251 c.Assert(status.File("CHANGELOG").Staging, Equals, Added)
1252}
1253
1254func (s *WorktreeSuite) TestResetMixed(c *C) {
1255 fs := memfs.New()

Callers

nothing calls this directly

Calls 8

CheckoutMethod · 0.95
ResetMethod · 0.95
StatusMethod · 0.95
NewHashFunction · 0.92
ReferenceMethod · 0.65
HashMethod · 0.65
IsCleanMethod · 0.45
FileMethod · 0.45

Tested by

no test coverage detected