clone

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package clone provides git repository cloning utilities for the build system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(err error) bool

IsError checks if an error is a clone Error.

Types

type Error

type Error struct {
	// GitURL is the URL that was being cloned
	GitURL string

	// GitRef is the ref that was being checked out
	GitRef string

	// Stderr contains the git stderr output
	Stderr string

	// ExitCode is the exit code from git
	ExitCode int

	// Err is the underlying error
	Err error
}

Error represents a detailed error from a git clone operation.

func AsError

func AsError(err error) (*Error, bool)

AsError attempts to convert an error to a clone Error.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying error.

type Result

type Result struct {
	// RepoPath is the path to the cloned repository
	RepoPath string

	// CommitSHA is the resolved commit SHA after checkout
	CommitSHA string
}

Result contains the result of a successful clone operation.

func Repository

func Repository(ctx context.Context, gitURL, gitRef, destPath string) (*Result, error)

Repository clones a git repository to the specified destination path. It uses shallow clone (--depth 1) for efficiency as specified in Requirements 4.1.

Parameters:

  • ctx: Context for cancellation
  • gitURL: The git repository URL to clone
  • gitRef: The git ref to checkout (branch, tag, or commit). If empty, uses default branch.
  • destPath: The destination path for the cloned repository

Returns:

  • *Result: Contains the repo path and resolved commit SHA
  • error: A *Error with detailed information on failure

**Validates: Requirements 1.1, 4.1**

Jump to

Keyboard shortcuts

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