aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-07-24 10:51:01 +0200
committerSantiago M. Mola <santi@mola.io>2017-08-01 13:01:54 +0200
commit9488c59834f6a2591910b7b360721cec2c16c548 (patch)
treefea051f6cf08a62aad12e32b2240aa837be22628 /remote.go
parent7b08a3005480a50f0f4290aff8f3702085d5e30d (diff)
downloadgo-git-9488c59834f6a2591910b7b360721cec2c16c548.tar.gz
config: multiple values in RemoteConfig (URLs and Fetch)
* Change `URL string` to `URL []string` in `RemoteConfig`, since git allows multiple URLs per remote. See: http://marc.info/?l=git&m=116231242118202&w=2 * Fix marshalling of multiple fetch refspecs.
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/remote.go b/remote.go
index fe44009..eb5a6a2 100644
--- a/remote.go
+++ b/remote.go
@@ -43,8 +43,11 @@ func (r *Remote) Config() *config.RemoteConfig {
}
func (r *Remote) String() string {
- fetch := r.c.URL
- push := r.c.URL
+ var fetch, push string
+ if len(r.c.URLs) > 0 {
+ fetch = r.c.URLs[0]
+ push = r.c.URLs[0]
+ }
return fmt.Sprintf("%s\t%s (fetch)\n%[1]s\t%[3]s (push)", r.c.Name, fetch, push)
}
@@ -71,7 +74,7 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) error {
return fmt.Errorf("remote names don't match: %s != %s", o.RemoteName, r.c.Name)
}
- s, err := newSendPackSession(r.c.URL, o.Auth)
+ s, err := newSendPackSession(r.c.URLs[0], o.Auth)
if err != nil {
return err
}
@@ -211,7 +214,7 @@ func (r *Remote) fetch(ctx context.Context, o *FetchOptions) (storer.ReferenceSt
o.RefSpecs = r.c.Fetch
}
- s, err := newUploadPackSession(r.c.URL, o.Auth)
+ s, err := newUploadPackSession(r.c.URLs[0], o.Auth)
if err != nil {
return nil, err
}