aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 78339d4..4297b81 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -174,6 +174,30 @@ func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDate(c *C) {
s.doTestFetchNoErrAlreadyUpToDate(c, url)
}
+func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDateButStillUpdateLocalRemoteRefs(c *C) {
+ url := s.GetBasicLocalRepositoryURL()
+
+ sto := memory.NewStorage()
+ r := newRemote(sto, &config.RemoteConfig{Name: "foo", URL: url})
+
+ refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*")
+ o := &FetchOptions{
+ RefSpecs: []config.RefSpec{refspec},
+ }
+
+ err := r.Fetch(o)
+ c.Assert(err, IsNil)
+
+ // Simulate an out of date remote ref even though we have the new commit locally
+ sto.SetReference(plumbing.NewReferenceFromStrings("refs/remotes/origin/master", "918c48b83bd081e863dbe1b80f8998f058cd8294"))
+
+ err = r.Fetch(o)
+ c.Assert(err, IsNil)
+ exp := plumbing.NewReferenceFromStrings("refs/remotes/origin/master", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
+ ref, _ := sto.Reference("refs/remotes/origin/master")
+ c.Assert(exp.String(), Equals, ref.String())
+}
+
func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDateWithNonCommitObjects(c *C) {
fixture := fixtures.ByTag("tags").One()
url := s.GetLocalRepositoryURL(fixture)