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

Method TestResetMixed

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

Source from the content-addressed store, hash-verified

1252}
1253
1254func (s *WorktreeSuite) TestResetMixed(c *C) {
1255 fs := memfs.New()
1256 w := &Worktree{
1257 r: s.Repository,
1258 Filesystem: fs,
1259 }
1260
1261 commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9")
1262
1263 err := w.Checkout(&CheckoutOptions{})
1264 c.Assert(err, IsNil)
1265
1266 err = w.Reset(&ResetOptions{Mode: MixedReset, Commit: commit})
1267 c.Assert(err, IsNil)
1268
1269 branch, err := w.r.Reference(plumbing.Master, false)
1270 c.Assert(err, IsNil)
1271 c.Assert(branch.Hash(), Equals, commit)
1272
1273 status, err := w.Status()
1274 c.Assert(err, IsNil)
1275 c.Assert(status.IsClean(), Equals, false)
1276 c.Assert(status.File("CHANGELOG").Staging, Equals, Untracked)
1277}
1278
1279func (s *WorktreeSuite) TestResetMerge(c *C) {
1280 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