Documentation
¶
Overview ¶
Package git provides a Git repository scan source.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafeDisplayURL ¶
SafeDisplayURL returns a credential-stripped form of raw that is safe to put in logs, output metadata, error messages, and the scan summary. Any user-info portion (the "user:password@" part of a URL) is removed so no secret is ever surfaced.
The returned value is the clean URL with no noisy suffix, so it can be stored verbatim in a metadata field. When the URL cannot be parsed, the credential between "://" and "@" is masked on a best-effort basis; non-URL targets (for example local paths) are returned unchanged.
Types ¶
type GitSource ¶
type GitSource struct {
// contains filtered or unexported fields
}
GitSource is a Git repository-based scan source.
func (*GitSource) Close ¶
Close cleans up temporary resources. For cloned repositories, it removes the temporary directory.
func (*GitSource) Err ¶ added in v1.7.0
Err returns the first terminal error that aborted Git history production, or nil if it completed normally. Any error stored here has been run through sanitizeCloneError, so it can never carry raw clone credentials. It must only be called after the channel returned by Chunks has been fully drained (closed).
type Option ¶
type Option func(*GitSource)
Option configures a GitSource.
func WithBufferSize ¶
WithBufferSize sets the chunk channel buffer size.
func WithExcludePaths ¶
WithExcludePaths sets glob patterns for file paths to exclude from scanning. Patterns are matched against each file's path within the repository, mirroring filesystem.WithExcludePaths semantics.
func WithMaxFileSize ¶
WithMaxFileSize sets the maximum file size to scan.
func WithSinceCommit ¶
WithSinceCommit scans only changes from the specified commit to HEAD.