vcs

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 3 Imported by: 0

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 NewResolver

func NewResolver() *Resolver

NewResolver returns an empty resolver.

func (*Resolver) Root

func (r *Resolver) Root(path string) string

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

func (r *Resolver) RootDir(dir string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL