(ctx context.Context, worktreePath string)
| 321 | } |
| 322 | |
| 323 | func (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 | |
| 342 | func (r *Repository) addGitNote(ctx context.Context, env *environment.Environment, note string) error { |
| 343 | worktreePath, err := r.WorktreePath(env.ID) |
no test coverage detected