(c *C)
| 252 | } |
| 253 | |
| 254 | func (s *WorktreeSuite) TestCommitAmendNothingToCommit(c *C) { |
| 255 | fs := memfs.New() |
| 256 | w := &Worktree{ |
| 257 | r: s.Repository, |
| 258 | Filesystem: fs, |
| 259 | } |
| 260 | |
| 261 | err := w.Checkout(&CheckoutOptions{}) |
| 262 | c.Assert(err, IsNil) |
| 263 | |
| 264 | err = util.WriteFile(fs, "foo", []byte("foo"), 0644) |
| 265 | c.Assert(err, IsNil) |
| 266 | |
| 267 | _, err = w.Add("foo") |
| 268 | c.Assert(err, IsNil) |
| 269 | |
| 270 | prevHash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature()}) |
| 271 | c.Assert(err, IsNil) |
| 272 | |
| 273 | _, err = w.Commit("bar\n", &CommitOptions{Author: defaultSignature(), AllowEmptyCommits: true}) |
| 274 | c.Assert(err, IsNil) |
| 275 | |
| 276 | amendedHash, err := w.Commit("foo\n", &CommitOptions{Author: defaultSignature(), Amend: true}) |
| 277 | c.Log(prevHash, amendedHash) |
| 278 | c.Assert(err, Equals, ErrEmptyCommit) |
| 279 | c.Assert(amendedHash, Equals, plumbing.ZeroHash) |
| 280 | } |
| 281 | |
| 282 | func (s *WorktreeSuite) TestAddAndCommitWithSkipStatus(c *C) { |
| 283 | expected := plumbing.NewHash("375a3808ffde7f129cdd3c8c252fd0fe37cfd13b") |
nothing calls this directly
no test coverage detected