| 1227 | } |
| 1228 | |
| 1229 | func (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 | |
| 1254 | func (s *WorktreeSuite) TestResetMixed(c *C) { |
| 1255 | fs := memfs.New() |