aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-06-24 05:39:18 +0200
committerGitHub <noreply@github.com>2020-06-24 05:39:18 +0200
commit9ac753f4afb36feb1a1c22214c16e853db54aa00 (patch)
tree4a8c9ab3e3ef1676e4cf120beb7e25aac8855b05 /worktree_test.go
parent16918a5be9a2076bbb686b2580da1988d557da6d (diff)
parent23e21f0cfc6196d5dce8fc20af0ecc9701aabe4f (diff)
downloadgo-git-9ac753f4afb36feb1a1c22214c16e853db54aa00.tar.gz
Merge pull request #109 from mruediger/master
Worktre: Pull, report "Already up to date" when local repository ahead of remote
Diffstat (limited to 'worktree_test.go')
-rw-r--r--worktree_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/worktree_test.go b/worktree_test.go
index c808ebd..59c80af 100644
--- a/worktree_test.go
+++ b/worktree_test.go
@@ -265,6 +265,26 @@ func (s *RepositorySuite) TestPullAdd(c *C) {
c.Assert(branch.Hash().String(), Not(Equals), "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
}
+func (s *WorktreeSuite) TestPullAlreadyUptodate(c *C) {
+ path := fixtures.Basic().ByTag("worktree").One().Worktree().Root()
+
+ r, err := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
+ URL: filepath.Join(path, ".git"),
+ })
+
+ c.Assert(err, IsNil)
+
+ w, err := r.Worktree()
+ c.Assert(err, IsNil)
+ err = ioutil.WriteFile(filepath.Join(path, "bar"), []byte("bar"), 0755)
+ c.Assert(err, IsNil)
+ _, err = w.Commit("bar", &CommitOptions{Author: defaultSignature()})
+ c.Assert(err, IsNil)
+
+ err = w.Pull(&PullOptions{})
+ c.Assert(err, Equals, NoErrAlreadyUpToDate)
+}
+
func (s *WorktreeSuite) TestCheckout(c *C) {
fs := memfs.New()
w := &Worktree{