MCPcopy
hub / github.com/go-git/go-git / preloadStatus

Function preloadStatus

status.go:121–148  ·  view source on GitHub ↗
(w *Worktree)

Source from the content-addressed store, hash-verified

119}
120
121func preloadStatus(w *Worktree) (Status, error) {
122 idx, err := w.r.Storer.Index()
123 if err != nil {
124 return nil, err
125 }
126
127 idxRoot := mindex.NewRootNode(idx)
128 nodes := []noder.Noder{idxRoot}
129
130 status := make(Status)
131 for len(nodes) > 0 {
132 var node noder.Noder
133 node, nodes = nodes[0], nodes[1:]
134 if node.IsDir() {
135 children, err := node.Children()
136 if err != nil {
137 return nil, err
138 }
139 nodes = append(nodes, children...)
140 continue
141 }
142 fs := status.File(node.Name())
143 fs.Worktree = Unmodified
144 fs.Staging = Unmodified
145 }
146
147 return status, nil
148}

Callers 1

newMethod · 0.85

Calls 5

IsDirMethod · 0.95
ChildrenMethod · 0.95
NameMethod · 0.95
IndexMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…