Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
fix: don't consider relative paths hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed Aug 2, 2024
1 parent 2a27207 commit 36e5cf1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/client/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ func ingestPaths(ctx context.Context, opts *IngestPathsOpts, ingestionFunc func(

if len(opts.IgnoreExtensions) > 0 {
for _, ext := range opts.IgnoreExtensions {
p := "*." + strings.TrimPrefix(ext, ".")
ignorePatterns = append(ignorePatterns, gitignore.ParsePattern(p, nil))
if ext != "" {
p := "*." + strings.TrimPrefix(ext, ".")
ignorePatterns = append(ignorePatterns, gitignore.ParsePattern(p, nil))
}
}
}

slog.Debug("Ignore patterns", "patterns", ignorePatterns)
slog.Debug("Ignore patterns", "patterns", ignorePatterns, "len", len(ignorePatterns))

ignore := gitignore.NewMatcher(ignorePatterns)

Expand All @@ -91,7 +93,7 @@ func ingestPaths(ctx context.Context, opts *IngestPathsOpts, ingestionFunc func(
for _, p := range paths {
path := p

if strings.HasPrefix(path, ".") {
if strings.HasPrefix(filepath.Base(filepath.Clean(path)), ".") {
if !opts.IncludeHidden {
slog.Debug("Ignoring hidden path", "path", path)
continue
Expand Down

0 comments on commit 36e5cf1

Please sign in to comment.