remote

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package remote turns a git remote URL into the pieces a forge call needs.

Index

Constants

View Source
const DefaultName = "origin"

DefaultName is the remote a project pushes to unless told otherwise.

Variables

View Source
var ErrNotARepository = errors.New("remote: not a repository URL")

ErrNotARepository reports a remote that cannot be read as owner/repo on a host.

Functions

This section is empty.

Types

type Remote

type Remote struct {
	// Host is the forge's hostname, without scheme, port or credentials.
	Host string

	// Owner is everything before the final path element. On this estate that
	// is frequently a nested group such as "phpboyscout/go", not a single
	// name.
	Owner string

	Repo string

	// Forge names the URL conventions, and is EMPTY when the host is not
	// recognised. A self-hosted instance cannot be identified by hostname, and
	// guessing would point every link in the changelog somewhere that does not
	// exist.
	Forge render.Forge

	// WebURL is the project's browsable URL, with any credentials removed.
	WebURL string
}

Remote is a parsed git remote.

func FromRepository

func FromRepository(path, name string) (Remote, error)

FromRepository reads the named remote out of the repository at path and parses it.

EnableDotGitCommonDir matters here for the same reason it does when reading history: in a linked worktree .git is a FILE pointing elsewhere, and without following it the repository opens and reports no remotes at all.

func Parse

func Parse(raw string) (Remote, error)

Parse reads a git remote URL in any of the forms git accepts.

Jump to

Keyboard shortcuts

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