Documentation
¶
Overview ¶
Package gitremote reads which GitHub repository a git checkout belongs to from its origin remote.
Index ¶
Constants ¶
const Owner = "giantswarm"
Owner is the GitHub organization of the repositories devctl generates files for.
Variables ¶
This section is empty.
Functions ¶
func OriginURL ¶
OriginURL returns the URL of the origin remote of the git checkout in dir, as `git remote get-url origin` prints it.
func RepoName ¶
RepoName returns the name of the giantswarm repository the git checkout in dir belongs to, read from its origin remote. It fails when the checkout has no origin remote or the remote is not a giantswarm repository. The name of the directory is never consulted: a worktree or a second clone is rarely named after its repository.
Types ¶
type Repo ¶
Repo is the GitHub repository a remote URL points to.
func Parse ¶
Parse returns the repository a git remote URL points to. It reads the <owner>/<name> path of a URL (https://github.com/giantswarm/devctl, ssh://git@github.com/giantswarm/devctl.git) and of git's scp-like syntax (git@github.com:giantswarm/devctl.git), a trailing .git stripped. The error never repeats the URL: an https remote may carry a token.