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

Method Unlock

locking/api.go:113–142  ·  view source on GitHub ↗
(ref *git.Ref, remote, id string, force bool)

Source from the content-addressed store, hash-verified

111}
112
113func (c *httpLockClient) Unlock(ref *git.Ref, remote, id string, force bool) (*unlockResponse, int, error) {
114 e := c.Endpoints.Endpoint("upload", remote)
115 suffix := fmt.Sprintf("locks/%s/unlock", id)
116 req, err := c.NewRequest("POST", e, suffix, &unlockRequest{
117 Force: force,
118 Ref: &lockRef{Name: ref.Refspec()},
119 })
120 if err != nil {
121 return nil, 0, err
122 }
123
124 req = c.Client.LogRequest(req, "lfs.locks.unlock")
125 res, err := c.DoAPIRequestWithAuth(remote, req)
126 if err != nil {
127 if res != nil {
128 return nil, res.StatusCode, err
129 }
130 return nil, 0, err
131 }
132
133 unlockRes := &unlockResponse{}
134 err = lfshttp.DecodeJSON(res, unlockRes)
135 if err != nil {
136 return nil, res.StatusCode, err
137 }
138 if unlockRes.Lock == nil && len(unlockRes.Message) == 0 {
139 return nil, res.StatusCode, errors.New(tr.Tr.Get("invalid server response"))
140 }
141 return unlockRes, res.StatusCode, nil
142}
143
144// Filter represents a single qualifier to apply against a set of locks.
145type lockFilter struct {

Callers 1

TestAPIUnlockFunction · 0.95

Calls 8

DecodeJSONFunction · 0.92
NewFunction · 0.92
RefspecMethod · 0.80
DoAPIRequestWithAuthMethod · 0.80
EndpointMethod · 0.65
GetMethod · 0.65
NewRequestMethod · 0.45
LogRequestMethod · 0.45

Tested by 1

TestAPIUnlockFunction · 0.76