diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-27 09:30:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 09:30:04 +0200 |
commit | c2561364e33763d3356a23c5850424a334de30e9 (patch) | |
tree | 76e38753b585d86643824f14f5c970db65046b45 /worktree_test.go | |
parent | 6b8d9f6d6bcf7f4282e5e4d7133f357d15ddc074 (diff) | |
parent | ab590eb89849a0319b8c5a4d7fd980137da7180d (diff) | |
download | go-git-c2561364e33763d3356a23c5850424a334de30e9.tar.gz |
Merge pull request #513 from mcuadros/worktree-fs
worktree: expose underlying filesystem
Diffstat (limited to 'worktree_test.go')
-rw-r--r-- | worktree_test.go | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/worktree_test.go b/worktree_test.go index c565e29..10774a4 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -252,8 +252,8 @@ func (s *RepositorySuite) TestPullAdd(c *C) { func (s *WorktreeSuite) TestCheckout(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{}) @@ -285,12 +285,12 @@ func (s *WorktreeSuite) TestCheckoutSymlink(c *C) { w, err := r.Worktree() c.Assert(err, IsNil) - w.fs.Symlink("not-exists", "bar") + w.Filesystem.Symlink("not-exists", "bar") w.Add("bar") w.Commit("foo", &CommitOptions{Author: defaultSignature()}) r.Storer.SetIndex(&index.Index{Version: 2}) - w.fs = osfs.New(filepath.Join(dir, "worktree-empty")) + w.Filesystem = osfs.New(filepath.Join(dir, "worktree-empty")) err = w.Checkout(&CheckoutOptions{}) c.Assert(err, IsNil) @@ -299,7 +299,7 @@ func (s *WorktreeSuite) TestCheckoutSymlink(c *C) { c.Assert(err, IsNil) c.Assert(status.IsClean(), Equals, true) - target, err := w.fs.Readlink("bar") + target, err := w.Filesystem.Readlink("bar") c.Assert(target, Equals, "not-exists") c.Assert(err, IsNil) } @@ -340,8 +340,8 @@ func (s *WorktreeSuite) TestCheckoutSubmoduleInitialized(c *C) { func (s *WorktreeSuite) TestCheckoutIndexMem(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{}) @@ -370,8 +370,8 @@ func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) { fs := osfs.New(filepath.Join(dir, "worktree")) w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err = w.Checkout(&CheckoutOptions{}) @@ -395,8 +395,8 @@ func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) { func (s *WorktreeSuite) TestCheckoutBranch(c *C) { w := &Worktree{ - r: s.Repository, - fs: memfs.New(), + r: s.Repository, + Filesystem: memfs.New(), } err := w.Checkout(&CheckoutOptions{ @@ -415,8 +415,8 @@ func (s *WorktreeSuite) TestCheckoutBranch(c *C) { func (s *WorktreeSuite) TestCheckoutCreateWithHash(c *C) { w := &Worktree{ - r: s.Repository, - fs: memfs.New(), + r: s.Repository, + Filesystem: memfs.New(), } err := w.Checkout(&CheckoutOptions{ @@ -438,8 +438,8 @@ func (s *WorktreeSuite) TestCheckoutCreateWithHash(c *C) { func (s *WorktreeSuite) TestCheckoutCreate(c *C) { w := &Worktree{ - r: s.Repository, - fs: memfs.New(), + r: s.Repository, + Filesystem: memfs.New(), } err := w.Checkout(&CheckoutOptions{ @@ -460,8 +460,8 @@ func (s *WorktreeSuite) TestCheckoutCreate(c *C) { func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) { w := &Worktree{ - r: s.Repository, - fs: memfs.New(), + r: s.Repository, + Filesystem: memfs.New(), } err := w.Checkout(&CheckoutOptions{ @@ -474,8 +474,8 @@ func (s *WorktreeSuite) TestCheckoutBranchAndHash(c *C) { func (s *WorktreeSuite) TestCheckoutCreateMissingBranch(c *C) { w := &Worktree{ - r: s.Repository, - fs: memfs.New(), + r: s.Repository, + Filesystem: memfs.New(), } err := w.Checkout(&CheckoutOptions{ @@ -557,8 +557,8 @@ func (s *WorktreeSuite) testCheckoutBisect(c *C, url string) { func (s *WorktreeSuite) TestCheckoutWithGitignore(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{}) @@ -586,8 +586,8 @@ func (s *WorktreeSuite) TestCheckoutWithGitignore(c *C) { func (s *WorktreeSuite) TestStatus(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } status, err := w.Status() @@ -635,8 +635,8 @@ func (s *WorktreeSuite) TestStatusEmptyDirty(c *C) { func (s *WorktreeSuite) TestReset(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9") @@ -659,8 +659,8 @@ func (s *WorktreeSuite) TestReset(c *C) { func (s *WorktreeSuite) TestResetMerge(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9") @@ -686,8 +686,8 @@ func (s *WorktreeSuite) TestResetMerge(c *C) { func (s *WorktreeSuite) TestResetHard(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } commit := plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9") @@ -713,8 +713,8 @@ func (s *WorktreeSuite) TestResetHard(c *C) { func (s *WorktreeSuite) TestStatusAfterCheckout(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -732,8 +732,8 @@ func (s *WorktreeSuite) TestStatusModified(c *C) { fs := osfs.New(filepath.Join(dir, "worktree")) w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err = w.Checkout(&CheckoutOptions{}) @@ -755,8 +755,8 @@ func (s *WorktreeSuite) TestStatusModified(c *C) { func (s *WorktreeSuite) TestStatusIgnored(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } w.Checkout(&CheckoutOptions{}) @@ -802,14 +802,14 @@ func (s *WorktreeSuite) TestStatusIgnored(c *C) { func (s *WorktreeSuite) TestStatusUntracked(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) c.Assert(err, IsNil) - f, err := w.fs.Create("foo") + f, err := w.Filesystem.Create("foo") c.Assert(err, IsNil) c.Assert(f.Close(), IsNil) @@ -825,8 +825,8 @@ func (s *WorktreeSuite) TestStatusDeleted(c *C) { fs := osfs.New(filepath.Join(dir, "worktree")) w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err = w.Checkout(&CheckoutOptions{}) @@ -872,8 +872,8 @@ func (s *WorktreeSuite) TestSubmodules(c *C) { func (s *WorktreeSuite) TestAddUntracked(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -883,7 +883,7 @@ func (s *WorktreeSuite) TestAddUntracked(c *C) { c.Assert(err, IsNil) c.Assert(idx.Entries, HasLen, 9) - err = util.WriteFile(w.fs, "foo", []byte("FOO"), 0755) + err = util.WriteFile(w.Filesystem, "foo", []byte("FOO"), 0755) c.Assert(err, IsNil) hash, err := w.Add("foo") @@ -916,8 +916,8 @@ func (s *WorktreeSuite) TestAddUntracked(c *C) { func (s *WorktreeSuite) TestAddModified(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -927,7 +927,7 @@ func (s *WorktreeSuite) TestAddModified(c *C) { c.Assert(err, IsNil) c.Assert(idx.Entries, HasLen, 9) - err = util.WriteFile(w.fs, "LICENSE", []byte("FOO"), 0644) + err = util.WriteFile(w.Filesystem, "LICENSE", []byte("FOO"), 0644) c.Assert(err, IsNil) hash, err := w.Add("LICENSE") @@ -955,8 +955,8 @@ func (s *WorktreeSuite) TestAddModified(c *C) { func (s *WorktreeSuite) TestAddUnmodified(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -998,8 +998,8 @@ func (s *WorktreeSuite) TestAddSymlink(c *C) { func (s *WorktreeSuite) TestRemove(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -1018,8 +1018,8 @@ func (s *WorktreeSuite) TestRemove(c *C) { func (s *WorktreeSuite) TestRemoveNotExistentEntry(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -1033,8 +1033,8 @@ func (s *WorktreeSuite) TestRemoveNotExistentEntry(c *C) { func (s *WorktreeSuite) TestRemoveDeletedFromWorktree(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -1056,8 +1056,8 @@ func (s *WorktreeSuite) TestRemoveDeletedFromWorktree(c *C) { func (s *WorktreeSuite) TestMove(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -1078,8 +1078,8 @@ func (s *WorktreeSuite) TestMove(c *C) { func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) @@ -1093,8 +1093,8 @@ func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) { func (s *WorktreeSuite) TestMoveToExistent(c *C) { fs := memfs.New() w := &Worktree{ - r: s.Repository, - fs: fs, + r: s.Repository, + Filesystem: fs, } err := w.Checkout(&CheckoutOptions{Force: true}) |