aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorOri Rawlings <orirawlings@gmail.com>2017-06-16 16:57:54 -0500
committerOri Rawlings <orirawlings@gmail.com>2017-06-19 13:20:35 -0500
commit78c539af957b559e15479f7ce5bcf0da5c27265a (patch)
tree43ab6da7cb9f94c269aa14af916e4bd1ee455e3d /remote_test.go
parent65bf694a758c768488685fff6b2c275f4bfe6b87 (diff)
downloadgo-git-78c539af957b559e15479f7ce5bcf0da5c27265a.tar.gz
Update local remote references during fetch even if no pack needs to be received
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)