MCPcopy
hub / github.com/git-lfs/git-lfs / NewClient

Function NewClient

lfsapi/lfsapi.go:24–46  ·  view source on GitHub ↗
(ctx lfshttp.Context)

Source from the content-addressed store, hash-verified

22}
23
24func NewClient(ctx lfshttp.Context) (*Client, error) {
25 if ctx == nil {
26 ctx = lfshttp.NewContext(nil, nil, nil)
27 }
28
29 gitEnv := ctx.GitEnv()
30 osEnv := ctx.OSEnv()
31
32 httpClient, err := lfshttp.NewClient(ctx)
33 if err != nil {
34 return nil, errors.Wrap(err, tr.Tr.Get("error creating HTTP client"))
35 }
36
37 c := &Client{
38 Endpoints: NewEndpointFinder(ctx),
39 client: httpClient,
40 context: ctx,
41 credContext: creds.NewCredentialHelperContext(gitEnv, osEnv),
42 access: creds.AllAccessModes(),
43 }
44
45 return c, nil
46}
47
48func (c *Client) Context() lfshttp.Context {
49 return c.context

Callers 15

TestAPILockFunction · 0.92
TestAPIUnlockFunction · 0.92
TestAPISearchFunction · 0.92
TestAPISearchVerifiableFunction · 0.92
TestRemoteLocksWithCacheFunction · 0.92
TestRefreshCacheFunction · 0.92
EnvironFunction · 0.92
getAPIClientFunction · 0.92
buildManifestFunction · 0.92
mainFunction · 0.92

Calls 9

NewContextFunction · 0.92
NewClientFunction · 0.92
WrapFunction · 0.92
AllAccessModesFunction · 0.92
NewEndpointFinderFunction · 0.85
GitEnvMethod · 0.65
OSEnvMethod · 0.65
GetMethod · 0.65

Tested by 15

TestAPILockFunction · 0.74
TestAPIUnlockFunction · 0.74
TestAPISearchFunction · 0.74
TestAPISearchVerifiableFunction · 0.74
TestRemoteLocksWithCacheFunction · 0.74
TestRefreshCacheFunction · 0.74
TestAPIBatchFunction · 0.74