(w *Worktree)
| 109 | ) |
| 110 | |
| 111 | func (s StatusStrategy) new(w *Worktree) (Status, error) { |
| 112 | switch s { |
| 113 | case Preload: |
| 114 | return preloadStatus(w) |
| 115 | case Empty: |
| 116 | return make(Status), nil |
| 117 | } |
| 118 | return nil, fmt.Errorf("%w: %+v", ErrUnsupportedStatusStrategy, s) |
| 119 | } |
| 120 | |
| 121 | func preloadStatus(w *Worktree) (Status, error) { |
| 122 | idx, err := w.r.Storer.Index() |