vcs

package
v0.16.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package vcs provides version-control detection that works across git and Jujutsu (jj) repositories. It dispatches to the pure-Go gitfs and jjfs helpers, and shells out to git for remote-URL detection (jj's backend is a git repo, so no jj binary is required).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(dir string) []string

Detect reports which version-control systems are present at or above dir, in stable order ("git" before "jj"). A colocated jj/git repo returns both; native jj returns only "jj"; a plain git repo returns only "git". Returns an empty (non-nil) slice when neither is found. Pure filesystem walk — no git or jj binary is invoked.

func DetectMainRepo

func DetectMainRepo(dir string) string

DetectMainRepo returns the canonical main-repo working directory if dir is inside a linked git worktree or a secondary jj workspace; otherwise "". git is tried first, jj is the fallback. The result is canonicalized via core.NormalizePath so it matches registered (canonical) project paths.

func DetectRemote

func DetectRemote(dir string) string

DetectRemote returns the origin remote URL for the repo containing dir, or "". It tries `git -C dir remote get-url origin` first (covers plain git and colocated jj). On failure it retries against the jj backing git directory (covers native jj). No jj binary is invoked.

Types

This section is empty.

Jump to

Keyboard shortcuts

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