From b32e92d013f6fe0d97f094c4b1991100d568f980 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 21 Aug 2016 01:07:15 +0200 Subject: remote and repository base on ConfigStore --- remote.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'remote.go') diff --git a/remote.go b/remote.go index db26e85..b023497 100644 --- a/remote.go +++ b/remote.go @@ -12,17 +12,16 @@ import ( // Remote represents a connection to a remote repository type Remote struct { - Config *config.RemoteConfig - + c *config.RemoteConfig s Storage + // cache fields, there during the connection is open upSrv common.GitUploadPackService upInfo *common.GitUploadPackInfo } -// NewRemote returns a new Remote, using as client http.DefaultClient -func NewRemote(s Storage, c *config.RemoteConfig) *Remote { - return &Remote{Config: c, s: s} +func newRemote(s Storage, c *config.RemoteConfig) *Remote { + return &Remote{s: s, c: c} } // Connect with the endpoint @@ -35,7 +34,7 @@ func (r *Remote) Connect() error { } func (r *Remote) connectUploadPackService() error { - endpoint, err := common.NewEndpoint(r.Config.URL) + endpoint, err := common.NewEndpoint(r.c.URL) if err != nil { return err } @@ -190,10 +189,6 @@ func (r *Remote) Refs() core.ReferenceIter { // Disconnect from the remote and save the config func (r *Remote) Disconnect() error { - if err := r.s.ConfigStorage().SetRemote(r.Config); err != nil { - return err - } - r.upInfo = nil return r.upSrv.Disconnect() } -- cgit