MCPcopy Index your code
hub / github.com/git-lfs/git-lfs / Resolve

Method Resolve

lfshttp/ssh.go:32–54  ·  view source on GitHub ↗
(e Endpoint, method string)

Source from the content-addressed store, hash-verified

30}
31
32func (c *sshCache) Resolve(e Endpoint, method string) (sshAuthResponse, error) {
33 if len(e.SSHMetadata.UserAndHost) == 0 {
34 return sshAuthResponse{}, nil
35 }
36
37 key := strings.Join([]string{e.SSHMetadata.UserAndHost, e.SSHMetadata.Port, e.SSHMetadata.Path, method}, "//")
38 if res, ok := c.endpoints[key]; ok {
39 if _, expired := res.IsExpiredWithin(5 * time.Second); !expired {
40 tracerx.Printf("ssh cache: %s git-lfs-authenticate %s %s",
41 e.SSHMetadata.UserAndHost, e.SSHMetadata.Path, endpointOperation(e, method))
42 return *res, nil
43 } else {
44 tracerx.Printf("ssh cache expired: %s git-lfs-authenticate %s %s",
45 e.SSHMetadata.UserAndHost, e.SSHMetadata.Path, endpointOperation(e, method))
46 }
47 }
48
49 res, err := c.ssh.Resolve(e, method)
50 if err == nil {
51 c.endpoints[key] = &res
52 }
53 return res, err
54}
55
56type sshAuthResponse struct {
57 Message string `json:"-"`

Callers

nothing calls this directly

Calls 3

endpointOperationFunction · 0.85
ResolveMethod · 0.65
IsExpiredWithinMethod · 0.45

Tested by

no test coverage detected