Documentation
¶
Index ¶
- func FindRepoRoot(path string) string
- func GenerateRootIDFromGit(path string) string
- func GenerateRootIDFromMultiPaths(commonRoot string, subPaths []string) string
- func GenerateRootIDFromPath(basePath string) string
- type GitInfo
- type GitignoreStack
- type Loader
- type PatternSet
- type StackBasedLoader
- func (l *StackBasedLoader) GetStack() *GitignoreStack
- func (l *StackBasedLoader) InitializeWithTopLevelExcludes(basePath string, excludePatterns []string, configExcludes []string) error
- func (l *StackBasedLoader) LoadAndPushGitignore(directory string) bool
- func (l *StackBasedLoader) PopGitignore()
- func (l *StackBasedLoader) ShouldExclude(name, relativePath string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindRepoRoot ¶
FindRepoRoot finds the git repository root for a given path Returns empty string if not in a git repository This is a fast operation that doesn't compute status
func GenerateRootIDFromGit ¶
GenerateRootIDFromGit generates a deterministic root ID from git remote URL and relative path If no remote URL is available, returns empty string
func GenerateRootIDFromMultiPaths ¶ added in v0.1.1
GenerateRootIDFromMultiPaths generates a deterministic root ID for a multi-path scan. It hashes the common root together with the sorted list of direct subfolder names, so different subsets of paths produce different IDs while the same set is stable. The subPaths must be the relative subfolder names (not full paths). If the common root is a git repo with a remote URL, the git-based identity is used as the base instead of the filesystem path, ensuring portability across machines.
func GenerateRootIDFromPath ¶
GenerateRootIDFromPath generates a deterministic root ID from absolute path Used when git repository is not available
Types ¶
type GitInfo ¶
type GitInfo struct {
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
RemoteURL string `json:"remote_url,omitempty"`
}
GitInfo contains git repository information
func GetGitInfo ¶
GetGitInfo retrieves git repository information for the given path Consider using GetGitInfoCached for better performance in recursive scans
func GetGitInfoWithRoot ¶
GetGitInfoWithRoot retrieves git info and returns the repository root path This allows callers to cache by repo root for better performance
type GitignoreStack ¶
type GitignoreStack struct {
// contains filtered or unexported fields
}
GitignoreStack represents a stack of .gitignore pattern sets
func NewGitignoreStack ¶
func NewGitignoreStack() *GitignoreStack
NewGitignoreStack creates a new empty gitignore stack
func (*GitignoreStack) GetAllPatterns ¶
func (gs *GitignoreStack) GetAllPatterns() []string
GetAllPatterns returns all patterns from the entire stack (in order)
func (*GitignoreStack) GetStackDepth ¶
func (gs *GitignoreStack) GetStackDepth() int
GetStackDepth returns the current depth of the stack
func (*GitignoreStack) Pop ¶
func (gs *GitignoreStack) Pop()
Pop removes the top pattern set from the stack
func (*GitignoreStack) Push ¶
func (gs *GitignoreStack) Push(directory string, patterns []string)
Push adds patterns from a .gitignore file to the stack
func (*GitignoreStack) ShouldExclude ¶
func (gs *GitignoreStack) ShouldExclude(name, relativePath string) bool
ShouldExclude checks if a file/directory should be excluded based on the current stack
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading ignore patterns from .gitignore files (legacy approach)
func NewGitignoreLoader ¶
func NewGitignoreLoader() *Loader
NewGitignoreLoader creates a new gitignore loader
func NewGitignoreLoaderWithLogger ¶
NewGitignoreLoaderWithLogger creates a new gitignore loader with logging
func NewGitignoreLoaderWithProgress ¶
NewGitignoreLoaderWithProgress creates a new gitignore loader with progress reporting
func (*Loader) LoadPatterns ¶
LoadPatterns loads ignore patterns from .gitignore files recursively Searches from the scan path down through all subdirectories Skips .gitignore files in directories that are typically cache/temp directories
type PatternSet ¶
type PatternSet struct {
Directory string // Directory where this .gitignore was found
Patterns []string // Patterns from this .gitignore
}
PatternSet represents patterns from a single .gitignore file
type StackBasedLoader ¶
type StackBasedLoader struct {
// contains filtered or unexported fields
}
StackBasedLoader handles loading ignore patterns in a stack-based approach
func NewStackBasedLoader ¶
func NewStackBasedLoader() *StackBasedLoader
NewStackBasedLoader creates a new stack-based gitignore loader
func NewStackBasedLoaderWithLogger ¶
func NewStackBasedLoaderWithLogger(prog *progress.Progress, logger *slog.Logger) *StackBasedLoader
NewStackBasedLoaderWithLogger creates a new stack-based gitignore loader with logging
func NewStackBasedLoaderWithProgress ¶
func NewStackBasedLoaderWithProgress(prog *progress.Progress) *StackBasedLoader
NewStackBasedLoaderWithProgress creates a new stack-based gitignore loader with progress reporting
func (*StackBasedLoader) GetStack ¶
func (l *StackBasedLoader) GetStack() *GitignoreStack
GetStack returns the current gitignore stack (for testing/debugging)
func (*StackBasedLoader) InitializeWithTopLevelExcludes ¶
func (l *StackBasedLoader) InitializeWithTopLevelExcludes(basePath string, excludePatterns []string, configExcludes []string) error
InitializeWithTopLevelExcludes adds config and CLI excludes as a top-level pseudo .gitignore
func (*StackBasedLoader) LoadAndPushGitignore ¶
func (l *StackBasedLoader) LoadAndPushGitignore(directory string) bool
LoadAndPushGitignore loads .gitignore for directory and pushes to stack if found Returns true if .gitignore was found and loaded successfully
func (*StackBasedLoader) PopGitignore ¶
func (l *StackBasedLoader) PopGitignore()
PopGitignore removes patterns from stack when leaving directory
func (*StackBasedLoader) ShouldExclude ¶
func (l *StackBasedLoader) ShouldExclude(name, relativePath string) bool
ShouldExclude checks if a file/directory should be excluded based on current stack