git

package
v0.21.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// RemoteOperationTimeout bounds one constrained remote materialization flow.
	// Git does not expose a reliable byte quota, so elapsed time is the
	// enforceable in-process boundary before checkout validation.
	RemoteOperationTimeout = 10 * time.Minute
)

Variables

This section is empty.

Functions

func ChangedLineRanges added in v0.14.17

func ChangedLineRanges(logger *zap.Logger, repoPath, baseRef, headRef string) (map[string][]LineRange, error)

ChangedLineRanges returns added/changed head-side line ranges from a git diff. Deleted-only hunks are omitted because there is no head line for SARIF to annotate.

func CheckoutRef

func CheckoutRef(logger *zap.Logger, repoPath, ref string) error

CheckoutRef checks out ref in repoPath.

func CloneTemp

func CloneTemp(ctx context.Context, logger *zap.Logger, repoURL, ref string) (string, error)

CloneTemp clones repoURL into a temporary directory and optionally checks out ref. The caller owns cleanup of the returned directory.

func FindRepoRoot

func FindRepoRoot(logger *zap.Logger, path string) (string, error)

FindRepoRoot resolves the git repository root for path.

func MaterializeLocalRef

func MaterializeLocalRef(ctx context.Context, logger *zap.Logger, sourceRepoPath, ref string) (string, error)

MaterializeLocalRef clones sourceRepoPath into a temporary directory and checks out ref. Local repositories are trusted inputs, so repository symlinks are preserved even when they point outside the checkout. The caller owns cleanup of the returned directory.

func MaterializeRemoteRef added in v0.21.0

func MaterializeRemoteRef(ctx context.Context, logger *zap.Logger, sourceRepoPath, ref string) (string, error)

MaterializeRemoteRef clones an already-fetched remote repository into a temporary directory, checks out ref, and validates the resulting tree. The caller owns cleanup of the returned directory.

func VerifyRef

func VerifyRef(logger *zap.Logger, repoPath, ref string) error

VerifyRef verifies that ref resolves to a commit in repoPath.

Types

type LineRange added in v0.14.17

type LineRange struct {
	Start int
	End   int
}

LineRange is an inclusive 1-based line range in a repository file.

Jump to

Keyboard shortcuts

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