Documentation
¶
Index ¶
- Constants
- func ChangedLineRanges(logger *zap.Logger, repoPath, baseRef, headRef string) (map[string][]LineRange, error)
- func CheckoutRef(logger *zap.Logger, repoPath, ref string) error
- func CloneTemp(ctx context.Context, logger *zap.Logger, repoURL, ref string) (string, error)
- func FindRepoRoot(logger *zap.Logger, path string) (string, error)
- func MaterializeLocalRef(ctx context.Context, logger *zap.Logger, sourceRepoPath, ref string) (string, error)
- func MaterializeRemoteRef(ctx context.Context, logger *zap.Logger, sourceRepoPath, ref string) (string, error)
- func VerifyRef(logger *zap.Logger, repoPath, ref string) error
- type LineRange
Constants ¶
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 ¶
CheckoutRef checks out ref in repoPath.
func CloneTemp ¶
CloneTemp clones repoURL into a temporary directory and optionally checks out ref. The caller owns cleanup of the returned directory.
func FindRepoRoot ¶
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.