gitclone

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package gitclone is the first git-clone plumbing in this repo: a small shallow-clone helper for `sf plugin install <git-url>` (and, later, `sf pack install`). It shells out to the user's own `git`, so authentication is ambient — whatever ssh-agent, a credential helper, or ~/.netrc already trusts — sofia never reads, stores, or asks for a token itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneShallow

func CloneShallow(url, ref, dst string) (string, error)

CloneShallow clones url at ref into dst (which must not already exist) and returns the commit it landed on. ref is a branch or tag name; "" clones the remote's default branch. Commit SHAs are not supported — `git clone --branch` doesn't accept one, and resolving one would need a full clone.

func IsURL

func IsURL(s string) bool

IsURL reports whether s names a git remote rather than a local path, by prefix alone (no regex, no network round-trip). Anything else — including relative and absolute filesystem paths — is treated as a local directory by the caller.

func RepoName

func RepoName(rawurl string) (string, error)

RepoName derives a plugin/pack name from a git URL: the last path segment, with a trailing ".git" and any trailing slash stripped. It understands both URL form (scheme://host/path) and the scp-like shorthand git@host:path.

func RepoSlug added in v0.14.0

func RepoSlug(rawurl string) (host, owner, repo string, err error)

RepoSlug parses a git remote URL into its host and the last two path segments (owner, repo) — the GitHub "owner/repo" a release lives under. It understands the same URL and scp-like forms as RepoName (RepoName gives only the repo, discarding the owner and host this needs). A trailing ".git" and trailing slash are stripped; fewer than two path segments is an error, since there is then no owner to report.

Types

This section is empty.

Jump to

Keyboard shortcuts

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