MCPcopy Create free account
hub / github.com/bluekeyes/patch2pr / applyCreate

Method applyCreate

graphql_applier.go:121–138  ·  view source on GitHub ↗
(ctx context.Context, f *gitdiff.File)

Source from the content-addressed store, hash-verified

119}
120
121func (a *GraphQLApplier) applyCreate(ctx context.Context, f *gitdiff.File) error {
122 _, exists, err := a.getContent(ctx, f.NewName)
123 if err != nil {
124 return err
125 }
126 if exists {
127 return &Conflict{Type: ConflictNewFileExists, File: f.NewName}
128 }
129
130 var b bytes.Buffer
131 if err := apply(&b, bytes.NewReader(nil), f.NewName, f); err != nil {
132 return err
133 }
134
135 a.changes[f.NewName] = pendingChange{Content: b.Bytes()}
136 a.modeCache[f.NewName] = defaultMode
137 return nil
138}
139
140func (a *GraphQLApplier) applyDelete(ctx context.Context, f *gitdiff.File) error {
141 data, exists, err := a.getContent(ctx, f.OldName)

Callers 1

ApplyMethod · 0.95

Calls 2

getContentMethod · 0.95
applyFunction · 0.85

Tested by

no test coverage detected