(c *C)
| 441 | } |
| 442 | |
| 443 | func (s *RepositorySuite) TestMergeFF(c *C) { |
| 444 | r, err := Init(memory.NewStorage(), memfs.New()) |
| 445 | c.Assert(err, IsNil) |
| 446 | c.Assert(r, NotNil) |
| 447 | |
| 448 | createCommit(c, r) |
| 449 | createCommit(c, r) |
| 450 | createCommit(c, r) |
| 451 | lastCommit := createCommit(c, r) |
| 452 | |
| 453 | wt, err := r.Worktree() |
| 454 | c.Assert(err, IsNil) |
| 455 | |
| 456 | targetBranch := plumbing.NewBranchReferenceName("foo") |
| 457 | err = wt.Checkout(&CheckoutOptions{ |
| 458 | Hash: lastCommit, |
| 459 | Create: true, |
| 460 | Branch: targetBranch, |
| 461 | }) |
| 462 | c.Assert(err, IsNil) |
| 463 | |
| 464 | createCommit(c, r) |
| 465 | fooHash := createCommit(c, r) |
| 466 | |
| 467 | // Checkout the master branch so that we can try to merge foo into it. |
| 468 | err = wt.Checkout(&CheckoutOptions{ |
| 469 | Branch: plumbing.Master, |
| 470 | }) |
| 471 | c.Assert(err, IsNil) |
| 472 | |
| 473 | head, err := r.Head() |
| 474 | c.Assert(err, IsNil) |
| 475 | c.Assert(head.Hash(), Equals, lastCommit) |
| 476 | |
| 477 | targetRef := plumbing.NewHashReference(targetBranch, fooHash) |
| 478 | c.Assert(targetRef, NotNil) |
| 479 | |
| 480 | err = r.Merge(*targetRef, MergeOptions{ |
| 481 | Strategy: FastForwardMerge, |
| 482 | }) |
| 483 | c.Assert(err, IsNil) |
| 484 | |
| 485 | head, err = r.Head() |
| 486 | c.Assert(err, IsNil) |
| 487 | c.Assert(head.Hash(), Equals, fooHash) |
| 488 | } |
| 489 | |
| 490 | func (s *RepositorySuite) TestMergeFF_Invalid(c *C) { |
| 491 | r, err := Init(memory.NewStorage(), memfs.New()) |
nothing calls this directly
no test coverage detected