MCPcopy
hub / github.com/jesseduffield/lazygit / commitFileNameAtDepth

Function commitFileNameAtDepth

pkg/gui/presentation/files.go:329–340  ·  view source on GitHub ↗
(node *filetree.Node[models.CommitFile], depth int)

Source from the content-addressed store, hash-verified

327}
328
329func commitFileNameAtDepth(node *filetree.Node[models.CommitFile], depth int) string {
330 splitName := split(node.GetInternalPath())
331 if depth == 0 && splitName[0] == "." {
332 if len(splitName) == 1 {
333 return "/"
334 }
335 depth = 1
336 }
337 name := join(splitName[depth:])
338
339 return name
340}
341
342func split(str string) []string {
343 return strings.Split(str, "/")

Callers 1

getCommitFileLineFunction · 0.85

Calls 3

GetInternalPathMethod · 0.80
splitFunction · 0.70
joinFunction · 0.70

Tested by

no test coverage detected