git

package
v0.27.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(ctx context.Context, repoURL, token, ref string, maxRepoSizeMB int) (dir string, commitSHA string, cleanup func(), err error)

Clone clones a git repository over HTTPS into a temporary directory. Returns the directory path, resolved HEAD commit SHA, a cleanup function, and any error.

The repoURL may embed a branch via the path (e.g. github.com/org/repo.git/mybranch). If ref is non-empty it overrides any branch embedded in the URL. If token is empty, Clone tries anonymous clone before retrying with GITHUB_AUTH_TOKEN. A zero maxRepoSizeMB uses the default 100 MB repository size limit.

func IsGitRepoURL

func IsGitRepoURL(repoURL string) bool

IsGitRepoURL returns true if the URL points to a git repository on a known hosting platform (GitHub, GitLab, Bitbucket) or ends with ".git".

func NormalizeRepositoryURL added in v0.26.1

func NormalizeRepositoryURL(repoURL string) (string, error)

NormalizeRepositoryURL validates an HTTPS Git repository URL, trims surrounding whitespace, and adds the HTTPS scheme when omitted. It preserves the repository path and any embedded branch so stored URLs and credential keys remain stable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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