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

Method Search

locking/api.go:210–238  ·  view source on GitHub ↗
(remote string, searchReq *lockSearchRequest)

Source from the content-addressed store, hash-verified

208}
209
210func (c *httpLockClient) Search(remote string, searchReq *lockSearchRequest) (*lockList, int, error) {
211 e := c.Endpoints.Endpoint("download", remote)
212 req, err := c.NewRequest("GET", e, "locks", nil)
213 if err != nil {
214 return nil, 0, err
215 }
216
217 q := req.URL.Query()
218 for key, value := range searchReq.QueryValues() {
219 q.Add(key, value)
220 }
221 req.URL.RawQuery = q.Encode()
222
223 req = c.Client.LogRequest(req, "lfs.locks.search")
224 res, err := c.DoAPIRequestWithAuth(remote, req)
225 if err != nil {
226 if res != nil {
227 return nil, res.StatusCode, err
228 }
229 return nil, 0, err
230 }
231
232 locks := &lockList{}
233 if res.StatusCode == http.StatusOK {
234 err = lfshttp.DecodeJSON(res, locks)
235 }
236
237 return locks, res.StatusCode, err
238}
239
240// lockVerifiableRequest encapsulates the request sent to the server when the
241// client would like a list of locks to verify a Git push.

Callers 1

TestAPISearchFunction · 0.95

Calls 8

DecodeJSONFunction · 0.92
QueryValuesMethod · 0.80
EncodeMethod · 0.80
DoAPIRequestWithAuthMethod · 0.80
EndpointMethod · 0.65
AddMethod · 0.65
NewRequestMethod · 0.45
LogRequestMethod · 0.45

Tested by 1

TestAPISearchFunction · 0.76