From f56336220f6ac9b5647980953fe6df8bb53ae01e Mon Sep 17 00:00:00 2001 From: Jeremy Stribling Date: Fri, 8 Feb 2019 11:28:24 -0800 Subject: config: add a way to see if a "remote" URL is local or not This factors out some URL-parsing code from the transport layer so it can be used by config as well. Issue: #909 Signed-off-by: Jeremy Stribling --- config/config.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'config') diff --git a/config/config.go b/config/config.go index a637f6d..2c3b8b9 100644 --- a/config/config.go +++ b/config/config.go @@ -8,6 +8,7 @@ import ( "sort" "strconv" + "gopkg.in/src-d/go-git.v4/internal/url" format "gopkg.in/src-d/go-git.v4/plumbing/format/config" ) @@ -399,3 +400,7 @@ func (c *RemoteConfig) marshal() *format.Subsection { return c.raw } + +func (c *RemoteConfig) IsFirstURLLocal() bool { + return url.IsLocalEndpoint(c.URLs[0]) +} -- cgit