Path return the entire path from the commit object to the root in leaf to root order.
(ctx context.Context, leaf ksuid.KSUID)
| 227 | // Path return the entire path from the commit object to the root |
| 228 | // in leaf to root order. |
| 229 | func (s *Store) Path(ctx context.Context, leaf ksuid.KSUID) ([]ksuid.KSUID, error) { |
| 230 | if leaf == ksuid.Nil { |
| 231 | return nil, errors.New("no path for nil commit ID") |
| 232 | } |
| 233 | if path, ok := s.paths.Get(leaf); ok { |
| 234 | return path, nil |
| 235 | } |
| 236 | path, err := s.PathRange(ctx, leaf, ksuid.Nil) |
| 237 | if err != nil { |
| 238 | return nil, err |
| 239 | } |
| 240 | s.paths.Add(leaf, path) |
| 241 | return path, nil |
| 242 | } |
| 243 | |
| 244 | func (s *Store) PathRange(ctx context.Context, from, to ksuid.KSUID) ([]ksuid.KSUID, error) { |
| 245 | var path []ksuid.KSUID |
no test coverage detected