(c *C)
| 166 | } |
| 167 | |
| 168 | func (s *WorktreeSuite) TestCommitAmendWithoutChanges(c *C) { |
| 169 | fs := memfs.New() |
| 170 | w := &Worktree{ |
| 171 | r: s.Repository, |
| 172 | Filesystem: fs, |
| 173 | } |
| 174 | |
| 175 | err := w.Checkout(&CheckoutOptions{}) |
| 176 | c.Assert(err, IsNil) |
| 177 | |
| 178 | err = util.WriteFile(fs, "foo", []byte("foo"), 0644) |
| 179 | c.Assert(err, IsNil) |
| 180 | |
| 181 | _, err = w.Add("foo") |
| 182 | c.Assert(err, IsNil) |
| 183 | |
| 184 | prevHash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature()}) |
| 185 | c.Assert(err, IsNil) |
| 186 | |
| 187 | amendedHash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature(), Amend: true}) |
| 188 | c.Assert(err, IsNil) |
| 189 | |
| 190 | headRef, err := w.r.Head() |
| 191 | c.Assert(err, IsNil) |
| 192 | |
| 193 | c.Assert(amendedHash, Equals, headRef.Hash()) |
| 194 | c.Assert(amendedHash, Equals, prevHash) |
| 195 | |
| 196 | commit, err := w.r.CommitObject(headRef.Hash()) |
| 197 | c.Assert(err, IsNil) |
| 198 | c.Assert(commit.Message, Equals, "foo\n") |
| 199 | |
| 200 | assertStorageStatus(c, s.Repository, 13, 11, 10, amendedHash) |
| 201 | } |
| 202 | |
| 203 | func (s *WorktreeSuite) TestCommitAmendWithChanges(c *C) { |
| 204 | fs := memfs.New() |
nothing calls this directly
no test coverage detected