MCPcopy Create free account
hub / github.com/cli/cli / gitRequests

Function gitRequests

script/ghmock/gittransport.go:247–268  ·  view source on GitHub ↗
(scratch string, requests []loggedRequest)

Source from the content-addressed store, hash-verified

245}
246
247func gitRequests(scratch string, requests []loggedRequest) ([]loggedRequest, error) {
248 ssh, err := readJSONL[loggedRequest](filepath.Join(scratch, "git-ssh.jsonl"))
249 if err != nil {
250 return nil, err
251 }
252 positions := map[string]int{}
253 for _, entry := range ssh {
254 if entry.Git != nil && entry.Git.ID != "" {
255 if index, ok := positions[entry.Git.ID]; ok {
256 requests[index] = entry
257 continue
258 }
259 positions[entry.Git.ID] = len(requests)
260 }
261 requests = append(requests, entry)
262 }
263 slices.SortStableFunc(requests, func(a, b loggedRequest) int { return a.Time.Compare(b.Time) })
264 for i := range requests {
265 requests[i].Seq = i + 1
266 }
267 return requests, nil
268}

Callers 2

runBinaryFunction · 0.85
cmdGitFunction · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected