(c *C)
| 445 | } |
| 446 | |
| 447 | func (s *WorktreeSuite) TestCheckoutSymlink(c *C) { |
| 448 | if runtime.GOOS == "windows" { |
| 449 | c.Skip("git doesn't support symlinks by default in windows") |
| 450 | } |
| 451 | |
| 452 | dir := c.MkDir() |
| 453 | |
| 454 | r, err := PlainInit(dir, false) |
| 455 | c.Assert(err, IsNil) |
| 456 | |
| 457 | w, err := r.Worktree() |
| 458 | c.Assert(err, IsNil) |
| 459 | |
| 460 | w.Filesystem.Symlink("not-exists", "bar") |
| 461 | w.Add("bar") |
| 462 | w.Commit("foo", &CommitOptions{Author: defaultSignature()}) |
| 463 | |
| 464 | r.Storer.SetIndex(&index.Index{Version: 2}) |
| 465 | w.Filesystem = osfs.New(filepath.Join(dir, "worktree-empty")) |
| 466 | |
| 467 | err = w.Checkout(&CheckoutOptions{}) |
| 468 | c.Assert(err, IsNil) |
| 469 | |
| 470 | status, err := w.Status() |
| 471 | c.Assert(err, IsNil) |
| 472 | c.Assert(status.IsClean(), Equals, true) |
| 473 | |
| 474 | target, err := w.Filesystem.Readlink("bar") |
| 475 | c.Assert(target, Equals, "not-exists") |
| 476 | c.Assert(err, IsNil) |
| 477 | } |
| 478 | |
| 479 | func TestCheckoutSymlinkArbitraryTarget(t *testing.T) { |
| 480 | if runtime.GOOS == "windows" { |
nothing calls this directly
no test coverage detected