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

Method loadState

repository/git.go:323–340  ·  view source on GitHub ↗
(ctx context.Context, worktreePath string)

Source from the content-addressed store, hash-verified

321}
322
323func (r *Repository) loadState(ctx context.Context, worktreePath string) ([]byte, error) {
324 var result []byte
325
326 err := r.lockManager.WithRLock(ctx, LockTypeNotes, func() error {
327 buff, err := RunGitCommand(ctx, worktreePath, "notes", "--ref", gitNotesStateRef, "show")
328 if err != nil {
329 if strings.Contains(err.Error(), "no note found") {
330 result = nil
331 return nil
332 }
333 return err
334 }
335 result = []byte(buff)
336 return nil
337 })
338
339 return result, err
340}
341
342func (r *Repository) addGitNote(ctx context.Context, env *environment.Environment, note string) error {
343 worktreePath, err := r.WorktreePath(env.ID)

Callers 3

GetMethod · 0.95
InfoMethod · 0.95
ListMethod · 0.95

Calls 2

RunGitCommandFunction · 0.85
WithRLockMethod · 0.45

Tested by

no test coverage detected