Debian Codegraph @

lfsapi/endpoint_finder.go

raw symbols SCIP
1 package lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/
2
3 import (
4 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
5 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
6 "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/"
7 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
8 "pathscip-go gomod github.com/golang/go/src go1.25.0 path/"
9 "regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/"
10 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
11 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
12
13 "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/"
14 "github.com/git-lfs/git-lfs/v3/credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/"
15 "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/"
16 "github.com/git-lfs/git-lfs/v3/lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/"
17 "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/"
18 "github.com/rubyist/tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/"
19 )
20
21 const (
22 defaultRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/defaultRemote. = "origin"
23 )
24
25 type EndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder# interface {
26 NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#NewEndpointFromCloneURL.(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#
27 NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#NewEndpoint.(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#
28 Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#Endpoint.(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#
29 RemoteEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#RemoteEndpoint.(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#
30 GitRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#GitRemoteURL.(remote string, forpush bool) string
31 AccessForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#AccessFor.(rawurl string) credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.Accessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#
32 SetAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#SetAccess.(access credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.Accessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#)
33 GitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#GitProtocol.() string
34 }
35
36 type endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder# struct {
37 gitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitConfig. *gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#
38 gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv. configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#
39 gitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitProtocol. string
40 gitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitDir. string
41
42 aliasMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliasMu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#
43 aliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliases. map[string]string
44 pushAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#pushAliases. map[string]string
45 remoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#remoteList. []string
46
47 accessMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#accessMu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#
48 urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess. map[string]credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#
49 urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlConfig. *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.URLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#
50 }
51
52 func NewEndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewEndpointFinder().(ctx lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Contextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#) EndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder# {
53 if ctx == nil {
54 ctx = lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, nil)
55 }
56
57 var gitDir string
58 cfg := ctx.GitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#GitConfig.()
59 if cfg != nil && cfg.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#GitDir. != "" {
60 gitDir = cfg.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#GitDir.
61 } else if dir, err := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitDir().(); err == nil {
62 gitDir = dir
63 }
64
65 e := &endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#{
66 gitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitConfig.: ctx.GitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#GitConfig.(),
67 gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv.: ctx.GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#GitEnv.(),
68 gitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitProtocol.: "https",
69 gitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitDir.: gitDir,
70 aliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliases.: make(map[string]string),
71 pushAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#pushAliases.: make(map[string]string),
72 urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.: make(map[string]credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#),
73 }
74
75 remotes, _ := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.RemoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteList().()
76 e.remoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#remoteList. = remotes
77
78 e.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlConfig. = configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewURLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewURLConfig().(e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv.)
79 if v, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("lfs.gitprotocol"); ok {
80 e.gitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitProtocol. = v
81 }
82 initAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/initAliases().(e, e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv.)
83
84 return e
85 }
86
87 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#Endpoint().(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
88 ep := e.getEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#getEndpoint().(operation, remote)
89 ep.Operationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Operation. = operation
90 return ep
91 }
92
93 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) getEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#getEndpoint().(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
94 if e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv. == nil {
95 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{}
96 }
97
98 if operation == "upload" {
99 if url, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("lfs.pushurl"); ok {
100 return e.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, url)
101 }
102 }
103
104 if url, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("lfs.url"); ok {
105 return e.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, url)
106 }
107
108 if len(remote) > 0 && remote != defaultRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/defaultRemote. {
109 if e := e.RemoteEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#RemoteEndpoint().(operation, remote); len(e.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.) > 0 {
110 return e
111 }
112 }
113
114 return e.RemoteEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#RemoteEndpoint().(operation, defaultRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/defaultRemote.)
115 }
116
117 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) RemoteEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#RemoteEndpoint().(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
118 if e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv. == nil {
119 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{}
120 }
121
122 if len(remote) == 0 {
123 remote = defaultRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/defaultRemote.
124 }
125
126 // Support separate push URL if specified and pushing
127 if operation == "upload" {
128 if url, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("remote." + remote + ".lfspushurl"); ok {
129 return e.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, url)
130 }
131 }
132 if url, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("remote." + remote + ".lfsurl"); ok {
133 return e.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, url)
134 }
135
136 // fall back on git remote url (also supports pushurl)
137 if url := e.GitRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#GitRemoteURL().(remote, operation == "upload"); url != "" {
138 return e.NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpointFromCloneURL().(operation, url)
139 }
140
141 // Finally, fall back on .git/FETCH_HEAD but only if it exists and no specific remote was requested
142 // We can't know which remote FETCH_HEAD is pointing to
143 if e.gitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitDir. != "" && remote == defaultRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/defaultRemote. {
144 url, err := parseFetchHeadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/parseFetchHead().(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().([]string{e.gitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitDir., "FETCH_HEAD"}, "/"))
145 if err == nil {
146 endpoint := e.NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpointFromCloneURL().("download", url)
147 return endpoint
148 } else {
149 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("failed parsing FETCH_HEAD: %s", err)
150 }
151 }
152
153 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{}
154 }
155
156 func parseFetchHeadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/parseFetchHead().(filePath string) (string, error) {
157 file, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Openscip-go gomod github.com/golang/go/src go1.25.0 os/Open().(filePath)
158 if err != nil {
159 return "", err
160 }
161 defer file.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().()
162
163 scanner := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewScannerscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewScanner().(file)
164 if scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
165 line := scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
166 return ExtractRemoteUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/ExtractRemoteUrl().(line)
167 }
168
169 return "", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("Failed to read content from %s", filePath)
170 }
171
172 func ExtractRemoteUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/ExtractRemoteUrl().(line string) (string, error) {
173 // see https://regex101.com/r/lYla7c/1
174 re := regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25.0 regexp/MustCompile().(`^[a-f0-9]{40,64}\t(not-for-merge)?\t(tag |branch |)'.*' of (?P<url>[\/\.\-\:\_a-zA-Z0-9]+)$`)
175
176 match := re.FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25.0 regexp/Regexp#FindStringSubmatch().(line)
177
178 for i, name := range re.SubexpNamesscip-go gomod github.com/golang/go/src go1.25.0 regexp/Regexp#SubexpNames().() {
179 if name == "url" {
180 if len(match) < i {
181 break
182 }
183 return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(match[i]), nil
184 }
185 }
186
187 return "", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("failed to extract remote URL from \"%s\"", line)
188 }
189
190 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) GitRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#GitRemoteURL().(remote string, forpush bool) string {
191 if e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv. != nil {
192 if forpush {
193 if u, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("remote." + remote + ".pushurl"); ok {
194 return u
195 }
196 }
197
198 if u, ok := e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("remote." + remote + ".url"); ok {
199 return u
200 }
201 }
202
203 if err := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.ValidateRemoteFromListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemoteFromList().(e.remoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#remoteList., remote); err == nil {
204 return remote
205 }
206
207 return ""
208 }
209
210 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpointFromCloneURL().(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
211 ep := e.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, rawurl)
212 if ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url. == lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.UrlUnknownscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/UrlUnknown. {
213 return ep
214 }
215
216 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasSuffix().(ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url., "/") {
217 ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url. = ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.[0 : len(ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.)-1]
218 }
219
220 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url., "file://") {
221 return ep
222 }
223
224 // When using main remote URL for HTTP, append info/lfs
225 if pathscip-go gomod github.com/golang/go/src go1.25.0 path/.Extscip-go gomod github.com/golang/go/src go1.25.0 path/Ext().(ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.) == ".git" {
226 ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url. += "/info/lfs"
227 } else {
228 ep.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url. += ".git/info/lfs"
229 }
230
231 return ep
232 }
233
234 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#NewEndpoint().(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
235 rawurl = e.ReplaceUrlAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#ReplaceUrlAlias().(operation, rawurl)
236 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(rawurl, "/") {
237 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromLocalPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromLocalPath().(rawurl)
238 }
239 u, err := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.Parsescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Parse().(rawurl)
240 if err != nil {
241 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromBareSshUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromBareSshUrl().(rawurl)
242 }
243
244 switch u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. {
245 case "ssh", "git+ssh", "ssh+git":
246 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromSshUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromSshUrl().(u)
247 case "http", "https":
248 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromHttpUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromHttpUrl().(u)
249 case "git":
250 return endpointFromGitUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointFromGitUrl().(u, e)
251 case "file":
252 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromFileUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromFileUrl().(u)
253 case "":
254 // If it looks like a local path, it probably is.
255 if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(rawurl); err == nil {
256 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromLocalPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromLocalPath().(rawurl)
257 }
258 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromBareSshUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromBareSshUrl().(u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().())
259 default:
260 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(rawurl, u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme.+"::") {
261 // Looks like a remote helper; just pass it through.
262 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.: rawurl}
263 }
264 // If it looks like a local path, it probably is.
265 if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(rawurl); err == nil {
266 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromLocalPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromLocalPath().(rawurl)
267 }
268 // We probably got here because the "scheme" that was parsed is
269 // a hostname (whether FQDN or single word) and the URL parser
270 // didn't know what to do with it. Do what Git does and treat
271 // it as an SSH URL. This ensures we handle SSH config aliases
272 // properly.
273 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.EndpointFromBareSshUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/EndpointFromBareSshUrl().(u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().())
274 }
275 }
276
277 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) AccessForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#AccessFor().(rawurl string) credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.Accessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access# {
278 accessurl := urlWithoutAuthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/urlWithoutAuth().(rawurl)
279
280 if e.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitEnv. == nil {
281 return credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NewAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewAccess().(credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NoneAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NoneAccess., accessurl)
282 }
283
284 e.accessMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#accessMu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().()
285 defer e.accessMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#accessMu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().()
286
287 if cached, ok := e.urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.[accessurl]; ok {
288 return credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NewAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewAccess().(cached, accessurl)
289 }
290
291 e.urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.[accessurl] = e.fetchGitAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#fetchGitAccess().(accessurl)
292 return credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NewAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewAccess().(e.urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.[accessurl], accessurl)
293 }
294
295 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) SetAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#SetAccess().(access credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.Accessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#) {
296 key := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("lfs.%s.access", access.URLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#URL().())
297 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("setting repository access to %s", access.Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#Mode().())
298
299 e.accessMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#accessMu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().()
300 defer e.accessMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#accessMu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().()
301
302 switch access.Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#Mode().() {
303 case credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.EmptyAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/EmptyAccess., credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NoneAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NoneAccess.:
304 e.gitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitConfig..UnsetLocalKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#UnsetLocalKey().(key)
305 e.urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.[access.URLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#URL().()] = credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NoneAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NoneAccess.
306 default:
307 e.gitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitConfig..SetLocalscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#SetLocal().(key, string(access.Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#Mode().()))
308 e.urlAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlAccess.[access.URLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#URL().()] = access.Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Access#Mode().()
309 }
310 }
311
312 func urlWithoutAuthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/urlWithoutAuth().(rawurl string) string {
313 if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(rawurl, "@") {
314 return rawurl
315 }
316
317 u, err := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.Parsescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Parse().(rawurl)
318 if err != nil {
319 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr., "Error parsing URL %q: %s", rawurl, err)
320 return rawurl
321 }
322
323 u.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. = nil
324 return u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().()
325 }
326
327 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) fetchGitAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#fetchGitAccess().(rawurl string) credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode# {
328 if v, _ := e.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#urlConfig..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Get().("lfs", rawurl, "access"); len(v) > 0 {
329 access := credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.25.0 strings/ToLower().(v))
330 if access == credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.PrivateAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/PrivateAccess. {
331 return credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.BasicAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/BasicAccess.
332 }
333 return access
334 }
335 return credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NoneAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NoneAccess.
336 }
337
338 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) GitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#GitProtocol().() string {
339 return e.gitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitProtocol.
340 }
341
342 // ReplaceUrlAlias returns a url with a prefix from a `url.*.insteadof` git
343 // config setting. If multiple aliases match, use the longest one.
344 // See https://git-scm.com/docs/git-config for Git's docs.
345 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) ReplaceUrlAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#ReplaceUrlAlias().(operation, rawurl string) string {
346 e.aliasMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliasMu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().()
347 defer e.aliasMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliasMu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().()
348
349 if operation == "upload" {
350 if rawurl, replaced := e.replaceUrlAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#replaceUrlAlias().(e.pushAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#pushAliases., rawurl); replaced {
351 return rawurl
352 }
353 }
354 rawurl, _ = e.replaceUrlAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#replaceUrlAlias().(e.aliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliases., rawurl)
355
356 return rawurl
357 }
358
359 // replaceUrlAlias is a helper function for ReplaceUrlAlias. It must only be
360 // called while the e.aliasMu mutex is held.
361 func (e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) replaceUrlAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#replaceUrlAlias().(aliases map[string]string, rawurl string) (string, bool) {
362 var longestalias string
363 for alias, _ := range aliases {
364 if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(rawurl, alias) {
365 continue
366 }
367
368 if longestalias < alias {
369 longestalias = alias
370 }
371 }
372
373 if len(longestalias) > 0 {
374 return aliases[longestalias] + rawurl[len(longestalias):], true
375 }
376
377 return rawurl, false
378 }
379
380 const (
381 aliasPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/aliasPrefix. = "url."
382 )
383
384 func initAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/initAliases().(e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#, git configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#) {
385 suffix := ".insteadof"
386 pushSuffix := ".pushinsteadof"
387 for gitkey, gitval := range git.Allscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#All.() {
388 if len(gitval) == 0 || !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(gitkey, aliasPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/aliasPrefix.) {
389 continue
390 }
391 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasSuffix().(gitkey, suffix) {
392 storeAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/storeAlias().(e.aliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#aliases., gitkey, gitval, suffix)
393 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasSuffix().(gitkey, pushSuffix) {
394 storeAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/storeAlias().(e.pushAliasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#pushAliases., gitkey, gitval, pushSuffix)
395 }
396 }
397 }
398
399 func storeAliasscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/storeAlias().(aliases map[string]string, key string, values []string, suffix string) {
400 for _, value := range values {
401 url := key[len(aliasPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/aliasPrefix.) : len(key)-len(suffix)]
402 if v, ok := aliases[value]; ok && v != url {
403 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintln().(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr., trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("warning: Multiple 'url.*.%s' keys with the same alias: %q", suffix, value))
404 }
405 aliases[value] = url
406 }
407 }
408
409 func endpointFromGitUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointFromGitUrl().(u *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#, e *endpointGitFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
410 u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. = e.gitProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/endpointGitFinder#gitProtocol.
411 return lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.: u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().()}
412 }