repolabel

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package repolabel derives the owner-independent display label for a git repository, used as the `origin_repo` group key on worktree listings. Leaf package so any layer can compute the same label without cross-imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeRepoLabel

func ComputeRepoLabel(repoPath string) string

ComputeRepoLabel returns the owner-independent display label for the repo rooted at repoPath. Prefers `git remote get-url origin` so forks of the same directory name stay distinguishable; falls back to the basename of repoPath when no remote is configured.

The returned value is persisted as `origin_repo` on the worktree row (see sync.Worktree.OriginRepo) and consumed by clients (mobile picker, TUI sidebar) as the group key when rendering worktrees by repo.

func RepoLabelFromURL

func RepoLabelFromURL(remoteURL, fallback string) string

RepoLabelFromURL derives a display label from a git remote URL. When the URL contains an owner segment, the label is "owner/repo" so forks of the same repo name remain distinguishable in the UI. When only a single path segment is present, the bare repo name is returned. fallback is used when the URL cannot be parsed into a meaningful name.

Examples:

"https://github.com/acme/api.git" → "acme/api"
"git@github.com:acme/api.git"     → "acme/api"
"https://github.com/acme/api"     → "acme/api"
"https://example.com/api"         → "api"

Types

This section is empty.

Jump to

Keyboard shortcuts

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