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

Method ReadStatusWithData

ssh/protocol.go:183–215  ·  view source on GitHub ↗

ReadStatusWithData reads a status, arguments, and any binary data. Note that the reader must be fully exhausted before invoking any other read methods.

()

Source from the content-addressed store, hash-verified

181// ReadStatusWithData reads a status, arguments, and any binary data. Note that
182// the reader must be fully exhausted before invoking any other read methods.
183func (conn *PktlineConnection) ReadStatusWithData() (int, []string, io.Reader, error) {
184 args := make([]string, 0, 100)
185 status := 0
186 seenStatus := false
187 for {
188 s, pktLen, err := conn.pl.ReadPacketTextWithLength()
189 if err != nil {
190 return 0, nil, nil, errors.NewProtocolError(tr.Tr.Get("error reading packet"), err)
191 }
192 if pktLen == 0 {
193 if !seenStatus {
194 return 0, nil, nil, errors.NewProtocolError(tr.Tr.Get("no status seen"), nil)
195 }
196 return 0, nil, nil, errors.NewProtocolError(tr.Tr.Get("unexpected flush packet"), nil)
197 } else if !seenStatus {
198 ok := false
199 if strings.HasPrefix(s, "status ") {
200 status, err = strconv.Atoi(s[7:])
201 ok = err == nil
202 }
203 if !ok {
204 return 0, nil, nil, errors.NewProtocolError(tr.Tr.Get("expected status line, got %q", s), err)
205 }
206 seenStatus = true
207 } else if pktLen == 1 {
208 break
209 } else {
210 args = append(args, s)
211 }
212 }
213
214 return status, args, pktlineReader(conn.pl), nil
215}
216
217// ReadStatusWithLines reads a status, arguments, and a set of text lines.
218func (conn *PktlineConnection) ReadStatusWithLines() (int, []string, []string, error) {

Callers 1

doDownloadMethod · 0.80

Calls 4

NewProtocolErrorFunction · 0.92
pktlineReaderFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected