aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-08-27 12:02:32 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-09-02 18:18:12 +0200
commit8c1e320dd40c8f99df46bdf0f1097d2365485519 (patch)
treea02ced29f8b3c5497733f75d0c040d62746ef5f1 /remote.go
parent5c762aefcd8dded79e25bc2055254b4146e2b5a9 (diff)
downloadgo-git-push_url.tar.gz
fix: collect also push URLsHEADpush_url
This is a hack: we should collect pull URLs and push URLs (if any) separately and use the appropriate ones, or perhaps add a flag to each URL, whether it is capable of pushing. Also, add test for the remote URLs (pull and push)
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/remote.go b/remote.go
index 170883a..e335945 100644
--- a/remote.go
+++ b/remote.go
@@ -83,7 +83,7 @@ func (r *Remote) String() string {
var fetch, push string
if len(r.c.URLs) > 0 {
fetch = r.c.URLs[0]
- push = r.c.URLs[0]
+ push = r.c.URLs[len(r.c.URLs) - 1]
}
return fmt.Sprintf("%s\t%s (fetch)\n%[1]s\t%[3]s (push)", r.c.Name, fetch, push)
@@ -111,7 +111,7 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) {
}
if o.RemoteURL == "" {
- o.RemoteURL = r.c.URLs[0]
+ o.RemoteURL = r.c.URLs[len(r.c.URLs) - 1]
}
s, err := newSendPackSession(o.RemoteURL, o.Auth, o.InsecureSkipTLS, o.CABundle, o.ProxyOptions)