(idx *index.Index, filename string, h plumbing.Hash)
| 546 | } |
| 547 | |
| 548 | func (w *Worktree) doAddFileToIndex(idx *index.Index, filename string, h plumbing.Hash) error { |
| 549 | // Mirror upstream's Index.Add gate at the v5 caller boundary: the |
| 550 | // index feeds future trees, so a name that the tree-side |
| 551 | // pathutil.ValidTreePath gate would reject must not enter the |
| 552 | // index in the first place. v5 keeps Index.Add's existing signature |
| 553 | // for API compatibility, so the validation happens here. |
| 554 | if err := pathutil.ValidTreePath(filename); err != nil { |
| 555 | return err |
| 556 | } |
| 557 | return w.doUpdateFileToIndex(idx.Add(filename), filename, h) |
| 558 | } |
| 559 | |
| 560 | func (w *Worktree) doUpdateFileToIndex(e *index.Entry, filename string, h plumbing.Hash) error { |
| 561 | info, err := w.Filesystem.Lstat(filename) |
no test coverage detected