submodule

package
v0.15.0-alpha.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubmoduleUpdateContext

func SubmoduleUpdateContext(ctx context.Context, s *git.Submodule, o *git.SubmoduleUpdateOptions) error

func UpdateSubmodules

func UpdateSubmodules(r *git.Repository, o *git.SubmoduleUpdateOptions) error

Types

type CapabilityDetector

type CapabilityDetector interface {
	// Detect queries the Git server at the given URL for its capabilities.
	// Returns the server's advertised capabilities or an error if unreachable.
	Detect(url string, auth transport.AuthMethod) (*capability.Capabilities, error)
	// ChooseStrategy selects the optimal fetch strategy based on capabilities.
	ChooseStrategy(caps *capability.Capabilities) capability.StrategyType
}

CapabilityDetectorInterface abstracts capability detection for testing. It allows injecting mock detectors to test Fetcher behavior without making actual network calls to Git servers.

type Fetcher

type Fetcher struct {

	// Auth contains credentials for authenticating with the remote server.
	Auth transport.AuthMethod
	// contains filtered or unexported fields
}

Fetcher orchestrates the fetching of a specific commit from a remote repository. It automatically detects server capabilities and selects the optimal strategy, or uses a forced strategy if configured (useful for testing or debugging).

func NewFetcher

func NewFetcher(auth transport.AuthMethod, repo *git.Repository, opts ...FetcherOption) (*Fetcher, error)

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, opts *plumbing.Hash) error

Fetch retrieves (fetch + checkout) a specific commit from the remote repository.

type FetcherFactory

type FetcherFactory func(auth transport.AuthMethod, repo *git.Repository) (SubmoduleFetcher, error)

type FetcherOption

type FetcherOption func(*Fetcher)

FetcherOption configures a Fetcher instance. Use with NewFetcher to customize behavior.

func WithDetector

func WithDetector(d CapabilityDetector) FetcherOption

WithDetector injects a custom capability detector. Primarily used for testing to avoid network calls.

func WithForcedStrategy

func WithForcedStrategy(st capability.StrategyType) FetcherOption

WithForcedStrategy forces the use of a specific strategy, completely bypassing capability detection. Useful for tests where you want to verify the behavior of each strategy against the same server.

func WithRemoteName

func WithRemoteName(name string) FetcherOption

func WithStrategies

func WithStrategies(s map[capability.StrategyType]Strategy) FetcherOption

WithStrategies injects custom strategy implementations. Primarily used for testing to verify strategy selection.

type Strategy

type Strategy interface {
	Type() capability.StrategyType
	// Execute fetches the specified commit from the remote.
	Execute(ctx context.Context, r *git.Repository, commitHash plumbing.Hash) error
}

Strategy defines the interface for fetch strategies. Each strategy implements a different approach to fetching a specific commit from a remote Git server, optimized for different server capabilities.

type SubmoduleFetcher

type SubmoduleFetcher interface {
	Fetch(ctx context.Context, opt *plumbing.Hash) error
}

func DefaultFetcherFactory

func DefaultFetcherFactory(auth transport.AuthMethod, repo *git.Repository) (SubmoduleFetcher, error)

type SubmoduleUpdater

type SubmoduleUpdater struct {
	// contains filtered or unexported fields
}

func NewSubmoduleUpdater

func NewSubmoduleUpdater(opts ...UpdaterOption) *SubmoduleUpdater

func (*SubmoduleUpdater) UpdateContext

func (*SubmoduleUpdater) UpdateSubmodules

func (u *SubmoduleUpdater) UpdateSubmodules(r *git.Repository, o *git.SubmoduleUpdateOptions) error

type UpdaterOption

type UpdaterOption func(*SubmoduleUpdater)

func WithFetcherFactory

func WithFetcherFactory(factory FetcherFactory) UpdaterOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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