git

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureWorktreeDeps

func EnsureWorktreeDeps(mainRepoPath, worktreePath, worktreeDomain string, secured bool)

EnsureWorktreeDeps sets up a worktree checkout with the dependencies it needs:

  • vendor/ and node_modules/ are symlinked from the main repo
  • .env is copied from the main repo with APP_URL rewritten to http(s)://<worktreeDomain>

func IsMainRepo

func IsMainRepo(sitePath string) bool

IsMainRepo returns true if sitePath/.git is a directory (not a file). A file means the repo itself is a worktree, not the main checkout.

func MainBranch

func MainBranch(sitePath string) string

MainBranch returns the current branch of the main repo checkout at sitePath, or an empty string if it cannot be determined.

func SanitizeBranch

func SanitizeBranch(branch string) string

SanitizeBranch converts a branch name to a subdomain-safe slug.

Types

type Worktree

type Worktree struct {
	Name   string // subdirectory name under .git/worktrees/
	Branch string // sanitized branch (subdomain-safe)
	Path   string // absolute path to checkout dir
	Domain string // "<sanitized-branch>.<siteDomain>"
}

Worktree represents a git worktree checkout for a registered site.

func DetectWorktrees

func DetectWorktrees(sitePath, siteDomain string) ([]Worktree, error)

DetectWorktrees returns the list of active worktrees for the given site.

Jump to

Keyboard shortcuts

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