MCPcopy Index your code
hub / github.com/github/github-mcp-server / mergeIssueFieldValues

Function mergeIssueFieldValues

pkg/github/issues.go:465–479  ·  view source on GitHub ↗

mergeIssueFieldValues returns a merged slice where incoming values override existing ones for the same field ID, and existing fields not present in incoming are preserved. Ordering is deterministic: incoming entries first in their original order, followed by any existing entries (in their original o

(existing, incoming []*github.IssueRequestFieldValue)

Source from the content-addressed store, hash-verified

463// Ordering is deterministic: incoming entries first in their original order, followed by any
464// existing entries (in their original order) whose field IDs weren't seen in incoming.
465func mergeIssueFieldValues(existing, incoming []*github.IssueRequestFieldValue) []*github.IssueRequestFieldValue {
466 seen := make(map[int64]struct{}, len(incoming))
467 result := make([]*github.IssueRequestFieldValue, 0, len(existing)+len(incoming))
468 for _, v := range incoming {
469 seen[v.FieldID] = struct{}{}
470 result = append(result, v)
471 }
472 for _, v := range existing {
473 if _, ok := seen[v.FieldID]; ok {
474 continue
475 }
476 result = append(result, v)
477 }
478 return result
479}
480
481// IssueFragment represents a fragment of an issue node in the GraphQL API.
482type IssueFragment struct {

Callers 1

UpdateIssueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected