Documentation
¶
Overview ¶
Package vcs resolves the version-controlled repository a file belongs to, so clover can namespace id= per repository: the same id in two different repositories is not a clash. The repository is the nearest ancestor directory holding a VCS marker (.git, .jj, .hg, .svn); lookups are cached per directory. The namespacing itself (prefixing id and from with the root) happens in the pipeline, keeping the executor and registry repo-agnostic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver maps a file to its git repository root, caching each directory it resolves so an ancestor is checked at most once. Safe for concurrent use by the scan workers.
func (*Resolver) Root ¶
Root returns the absolute path of the repository the file at path belongs to - the nearest ancestor directory containing a VCS marker (.git, .jj, .hg, .svn) - or "" when the file is not inside a repository. The result is the namespace under which the file's id= is unique.
func (*Resolver) RootDir ¶
RootDir returns the absolute path of the repository containing the directory dir - the nearest ancestor, dir itself included, holding a VCS marker - or "" when dir is not inside a repository. Unlike Root, dir is the search start rather than a file whose parent is searched, so a scanned directory anchors on its own repository root.