| 1104 | } |
| 1105 | |
| 1106 | func (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 | |
| 1131 | func (s *WorktreeSuite) TestResetMixed(c *C) { |
| 1132 | fs := memfs.New() |