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

Method TestResetSoft

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

Source from the content-addressed store, hash-verified

1104}
1105
1106func (s *WorktreeSuite) TestResetSoft(c *C) {
1107 fs := memfs.New()
1108 w := &Worktree{
1109 r: s.Repository,
1110 Filesystem: fs,
1111 }
1112
1113 commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9")
1114
1115 err := w.Checkout(&CheckoutOptions{})
1116 c.Assert(err, IsNil)
1117
1118 err = w.Reset(&ResetOptions{Mode: SoftReset, Commit: commit})
1119 c.Assert(err, IsNil)
1120
1121 branch, err := w.r.Reference(plumbing.Master, false)
1122 c.Assert(err, IsNil)
1123 c.Assert(branch.Hash(), Equals, commit)
1124
1125 status, err := w.Status()
1126 c.Assert(err, IsNil)
1127 c.Assert(status.IsClean(), Equals, false)
1128 c.Assert(status.File("CHANGELOG").Staging, Equals, Added)
1129}
1130
1131func (s *WorktreeSuite) TestResetMixed(c *C) {
1132 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