Skip to content

Commit e97fb2f

Browse files
authored
Merge pull request #629 from fluxcd/bug-sourceignore
2 parents c00b601 + 501c8be commit e97fb2f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

controllers/gitrepository_controller.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"os"
24+
"path/filepath"
2425
"strings"
2526
"time"
2627

@@ -496,19 +497,20 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context,
496497
defer unlock()
497498

498499
// Load ignore rules for archiving
499-
ps, err := sourceignore.LoadIgnorePatterns(dir, nil)
500+
ignoreDomain := strings.Split(dir, string(filepath.Separator))
501+
ps, err := sourceignore.LoadIgnorePatterns(dir, ignoreDomain)
500502
if err != nil {
501503
return sreconcile.ResultEmpty, &serror.Event{
502504
Err: fmt.Errorf("failed to load source ignore patterns from repository: %w", err),
503505
Reason: "SourceIgnoreError",
504506
}
505507
}
506508
if obj.Spec.Ignore != nil {
507-
ps = append(ps, sourceignore.ReadPatterns(strings.NewReader(*obj.Spec.Ignore), nil)...)
509+
ps = append(ps, sourceignore.ReadPatterns(strings.NewReader(*obj.Spec.Ignore), ignoreDomain)...)
508510
}
509511

510512
// Archive directory to storage
511-
if err := r.Storage.Archive(&artifact, dir, SourceIgnoreFilter(ps, nil)); err != nil {
513+
if err := r.Storage.Archive(&artifact, dir, SourceIgnoreFilter(ps, ignoreDomain)); err != nil {
512514
e := &serror.Event{
513515
Err: fmt.Errorf("unable to archive artifact to storage: %w", err),
514516
Reason: sourcev1.ArchiveOperationFailedReason,

0 commit comments

Comments
 (0)