MCPcopy
hub / github.com/dagger/container-use / propagateGitNotes

Method propagateGitNotes

repository/git.go:277–296  ·  view source on GitHub ↗
(ctx context.Context, ref string)

Source from the content-addressed store, hash-verified

275 return nil
276}
277func (r *Repository) propagateGitNotes(ctx context.Context, ref string) error {
278 fullRef := fmt.Sprintf("refs/notes/%s", ref)
279
280 return r.lockManager.WithLock(ctx, LockTypeUserRepo, func() error {
281 fetch := func() error {
282 _, err := RunGitCommand(ctx, r.userRepoPath, "fetch", containerUseRemote, fullRef+":"+fullRef)
283 return err
284 }
285
286 if err := fetch(); err != nil {
287 if strings.Contains(err.Error(), "[rejected]") {
288 if _, err := RunGitCommand(ctx, r.userRepoPath, "update-ref", "-d", fullRef); err == nil {
289 return fetch()
290 }
291 }
292 return err
293 }
294 return nil
295 })
296}
297
298func (r *Repository) saveState(ctx context.Context, env *environment.Environment) error {
299 state, err := env.State.Marshal()

Callers 2

propagateToWorktreeMethod · 0.95
addGitNoteMethod · 0.95

Calls 2

RunGitCommandFunction · 0.85
WithLockMethod · 0.45

Tested by

no test coverage detected