gitremote

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gitremote canonicalizes a git origin URL into akari's project key: a stable "authority/owner/.../repo" string that is identical across machines, clone URLs (ssh, https, scp-like), and worktrees. Keying projects by this canonical remote (not the local directory) is what collapses every checkout of a repo into one project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSSHAliases

func LoadSSHAliases() map[string]string

LoadSSHAliases reads ~/.ssh/config and returns a map of Host alias to its resolved HostName. Missing or unreadable config yields an empty map; alias resolution is purely best effort.

Types

type Remote

type Remote struct {
	Key   string // authority/owner/.../repo, the canonical project key
	Host  string // host authority, with IPv6 addresses bracketed
	Owner string // everything between host and repo (may contain slashes)
	Repo  string // final path segment
}

Remote is a canonicalized origin URL.

func Canonicalize

func Canonicalize(raw string, aliases map[string]string) (Remote, error)

Canonicalize turns an origin URL into a canonical project key. aliases maps an ssh Host alias to its real HostName (from LoadSSHAliases); pass nil to skip alias resolution. Alias resolution is best effort: an unresolved alias is left as-is, which at worst yields a duplicate project rather than a wrong merge.

Jump to

Keyboard shortcuts

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