repo

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package repo says which repository an address names.

`git@gitlab.com:Acme/Web.git` and `https://gitlab.com/acme/web` are the same repository, so the identity is the host and the path, lowercased. The path is the owner and the name, with whatever groups sit between them on a host that nests them (GitLab's subgroups: `gitlab.com/acme/tools/web`). An address that does not name a host, an owner and a name is not a repository, which is also where `file://`, `ext::` and a pasted web page stop.

SSH or HTTPS is transport, not identity: it follows from the credential the repository is read with. Ports and users are the host's, not the repository's, so `https://git.example.com:3000/acme/web` and `ssh://git@git.example.com:2222/acme/web.git` are both the repository `https://git.example.com/acme/web`; Hosts says how each host is reached when not on the usual ports.

Index

Constants

View Source
const MaxDepth = 21

MaxDepth is how many segments a repository's path may have: GitLab nests up to twenty groups, and nothing deeper is a repository.

Variables

This section is empty.

Functions

func Relative

func Relative(address string, parent Repo) string

Relative resolves a submodule address written relative to its superproject, as `../web.git`, and returns any other address unchanged.

Types

type Host

type Host struct {
	HTTPSPort int    `toml:"https_port"`
	SSHPort   int    `toml:"ssh_port"`
	SSHUser   string `toml:"ssh_user"`
}

Host is how a host is reached when not over HTTPS on 443 and SSH as `git` on 22, as a Gitea or Forgejo on `:3000` and `:2222` is. A port of 0 is the usual one.

type Hosts

type Hosts map[string]Host

Hosts are the hosts reached otherwise, by host name as repositories name them (lowercased). A host that is not here is reached the usual way.

func (Hosts) HTTPS

func (hosts Hosts) HTTPS(repository Repo) string

HTTPS is the address a repository is read at over HTTPS, on its host's port.

func (Hosts) SSH

func (hosts Hosts) SSH(repository Repo) string

SSH is the address a key reads a repository at, as its host's user and on its port.

type Repo

type Repo struct {
	Host string
	Path string
}

Repo is one repository, however its address was written. Path is `owner/name`, or `owner/group/…/name` on a host with nested groups.

func Of

func Of(address string) (Repo, bool)

Of returns the repository an address names, and false when it names none.

func (Repo) Dir

func (repository Repo) Dir(pools string) string

Dir is where the repository's pool lives under the pools directory.

func (Repo) HTTPS

func (repository Repo) HTTPS() string

HTTPS is the canonical address, the one stored, compared and logged. It names no port: the address the repository is read at is Hosts.HTTPS.

func (Repo) String

func (repository Repo) String() string

Jump to

Keyboard shortcuts

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