capability

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	AllowReachableSHA1InWant bool
	AllowTipSHA1InWant       bool
	Shallow                  bool
}

Capabilities represents fetch-related capabilities advertised by a Git server.

func (*Capabilities) CanFetchBySHA

func (c *Capabilities) CanFetchBySHA() bool

CanFetchBySHA returns true if the server allows fetching by arbitrary SHA.

func (*Capabilities) CanFetchShallow

func (c *Capabilities) CanFetchShallow() bool

CanFetchShallow returns true if the server supports shallow clones.

type CapabilityDetector

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

CapabilityDetector detects Git server capabilities.

func NewCapabilityDetector

func NewCapabilityDetector() *CapabilityDetector

NewCapabilityDetector creates a new CapabilityDetector with the default session factory.

func NewCapabilityDetectorWithFactory

func NewCapabilityDetectorWithFactory(factory SessionFactory) *CapabilityDetector

NewCapabilityDetectorWithFactory creates a new CapabilityDetector with a custom session factory.

func (*CapabilityDetector) ChooseStrategy

func (d *CapabilityDetector) ChooseStrategy(caps *Capabilities) StrategyType

The ChooseStrategy method in the CapabilityDetector struct is determining the appropriate strategy type based on the capabilities provided by the Git server. It takes a Capabilities struct as input and evaluates the capabilities to decide which strategy should be used for fetching data from the server.

func (*CapabilityDetector) Detect

Detect ask the server for capabilities and return the supported capabilities Detect queries the Git server at the given URL and returns its capabilities.

type DefaultSessionFactory

type DefaultSessionFactory struct{}

DefaultSessionFactory is the production implementation that connects to real Git servers.

func NewDefaultSessionFactory

func NewDefaultSessionFactory() *DefaultSessionFactory

NewDefaultSessionFactory creates a new DefaultSessionFactory.

func (*DefaultSessionFactory) NewSession

NewSession creates a new upload-pack session to the specified Git server.

type SessionFactory

type SessionFactory interface {
	NewSession(url string, auth transport.AuthMethod) (UploadPackSession, error)
}

SessionFactory creates upload-pack sessions to Git servers. Implementations can be swapped for testing or custom transport logic.

type StrategyType

type StrategyType int
const (
	StrategyShallowSHA StrategyType = iota
	StrategyFullSHA
	StrategyIncrementalDeepen
	StrategyFullClone
)

func (StrategyType) String

func (st StrategyType) String() string

type UploadPackSession

type UploadPackSession interface {
	AdvertisedReferences() (*packp.AdvRefs, error)
	Close() error
}

UploadPackSession represents a Git upload-pack session. This interface wraps transport.UploadPackSession to enable testing.

Jump to

Keyboard shortcuts

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