MCPcopy Create free account
hub / github.com/alibaba/open-code-review / firstLevelDirKey

Function firstLevelDirKey

internal/scan/batch.go:110–116  ·  view source on GitHub ↗

firstLevelDirKey returns the first path segment of a repo-relative path, or " " for files directly in the repo root.

(it model.ScanItem)

Source from the content-addressed store, hash-verified

108// firstLevelDirKey returns the first path segment of a repo-relative path,
109// or "<root>" for files directly in the repo root.
110func firstLevelDirKey(it model.ScanItem) string {
111 idx := strings.IndexByte(it.Path, '/')
112 if idx < 0 {
113 return "<root>"
114 }
115 return it.Path[:idx]
116}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected