MCPcopy
hub / github.com/wagoodman/dive / Path

Method Path

dive/filetree/file_node.go:275–296  ·  view source on GitHub ↗

Path returns a slash-delimited string from the root of the greater tree to the current node (e.g. /a/path/to/here)

()

Source from the content-addressed store, hash-verified

273
274// Path returns a slash-delimited string from the root of the greater tree to the current node (e.g. /a/path/to/here)
275func (node *FileNode) Path() string {
276 if node.path == "" {
277 var path []string
278 curNode := node
279 for {
280 if curNode.Parent == nil {
281 break
282 }
283
284 name := curNode.Name
285 if curNode == node {
286 // white out prefixes are fictitious on leaf nodes
287 name = strings.TrimPrefix(name, whiteoutPrefix)
288 }
289
290 path = append([]string{name}, path...)
291 curNode = curNode.Parent
292 }
293 node.path = "/" + strings.Join(path, "/")
294 }
295 return strings.Replace(node.path, "//", "/", -1)
296}
297
298// deriveDiffType determines a DiffType to the current FileNode. Note: the DiffType of a node is always the DiffType of
299// its attributes and its contents. The contents are the bytes of the file of the children of a directory.

Callers 15

extractFileMethod · 0.80
SetTreeByLayerMethod · 0.80
CursorLeftMethod · 0.80
getAbsPositionNodeMethod · 0.80
UpdateMethod · 0.80
AssertDiffTypeFunction · 0.80
TestCompareWithNoChangesFunction · 0.80
TestCompareWithAddsFunction · 0.80
TestCompareWithChangesFunction · 0.80
TestCompareWithRemovesFunction · 0.80
TestRemoveOnIterateFunction · 0.80
TestPathFunction · 0.80

Calls

no outgoing calls

Tested by 7

AssertDiffTypeFunction · 0.64
TestCompareWithNoChangesFunction · 0.64
TestCompareWithAddsFunction · 0.64
TestCompareWithChangesFunction · 0.64
TestCompareWithRemovesFunction · 0.64
TestRemoveOnIterateFunction · 0.64
TestPathFunction · 0.64