aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorJeremy Stribling <strib@alum.mit.edu>2019-02-08 11:28:24 -0800
committerJeremy Stribling <strib@alum.mit.edu>2019-02-11 15:13:11 -0800
commitf56336220f6ac9b5647980953fe6df8bb53ae01e (patch)
tree87032fe128e9a0128ff1c32656ccd8c809c2cd0b /config
parentefe6c8be74a942c902f4812146ff016827ad9626 (diff)
downloadgo-git-f56336220f6ac9b5647980953fe6df8bb53ae01e.tar.gz
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 <strib@alum.mit.edu>
Diffstat (limited to 'config')
-rw-r--r--config/config.go5
1 files changed, 5 insertions, 0 deletions
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])
+}