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

Method Lock

locking/ssh.go:143–167  ·  view source on GitHub ↗
(remote string, lockReq *lockRequest)

Source from the content-addressed store, hash-verified

141}
142
143func (c *sshLockClient) Lock(remote string, lockReq *lockRequest) (*lockResponse, int, error) {
144 args := make([]string, 0, 3)
145 args = append(args, fmt.Sprintf("path=%s", lockReq.Path))
146 if lockReq.Ref != nil {
147 args = append(args, fmt.Sprintf("refname=%s", lockReq.Ref.Name))
148 }
149 conn, err := c.connection()
150 if err != nil {
151 return nil, 0, err
152 }
153 conn.Lock()
154 defer conn.Unlock()
155 err = conn.SendMessage("lock", args)
156 if err != nil {
157 return nil, 0, err
158 }
159 status, args, lines, err := conn.ReadStatusWithLines()
160 if err != nil {
161 return nil, status, err
162
163 }
164 var lock lockResponse
165 lock.Lock, lock.Message, err = c.parseLockResponse(status, args, lines)
166 return &lock, status, err
167}
168
169func (c *sshLockClient) Unlock(ref *git.Ref, remote, id string, force bool) (*unlockResponse, int, error) {
170 args := make([]string, 0, 3)

Callers

nothing calls this directly

Calls 6

connectionMethod · 0.95
parseLockResponseMethod · 0.95
SendMessageMethod · 0.80
ReadStatusWithLinesMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected