@@ -24,6 +24,7 @@ import (
24
24
"fmt"
25
25
"hash"
26
26
"io"
27
+ "io/fs"
27
28
"net/url"
28
29
"os"
29
30
"path/filepath"
@@ -32,16 +33,12 @@ import (
32
33
"time"
33
34
34
35
securejoin "github.com/cyphar/filepath-securejoin"
36
+ "github.com/fluxcd/pkg/lockedfile"
37
+ "github.com/fluxcd/pkg/untar"
35
38
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
36
- kerrors "k8s.io/apimachinery/pkg/util/errors"
37
-
38
39
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
40
+ kerrors "k8s.io/apimachinery/pkg/util/errors"
39
41
40
- "github.com/fluxcd/pkg/lockedfile"
41
-
42
- "io/fs"
43
-
44
- "github.com/fluxcd/pkg/untar"
45
42
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
46
43
sourcefs "github.com/fluxcd/source-controller/internal/fs"
47
44
"github.com/fluxcd/source-controller/pkg/sourceignore"
@@ -181,7 +178,7 @@ func (s *Storage) getGarbageFiles(artifact sourcev1.Artifact, totalCountLimit, m
181
178
return nil
182
179
}
183
180
if totalFiles >= totalCountLimit {
184
- return fmt .Errorf ("Reached file walking limit, already walked over: %d" , totalFiles )
181
+ return fmt .Errorf ("reached file walking limit, already walked over: %d" , totalFiles )
185
182
}
186
183
info , err := d .Info ()
187
184
if err != nil {
@@ -190,8 +187,8 @@ func (s *Storage) getGarbageFiles(artifact sourcev1.Artifact, totalCountLimit, m
190
187
}
191
188
createdAt := info .ModTime ().UTC ()
192
189
diff := now .Sub (createdAt )
193
- // compare the time difference between now and the time at which the file was created
194
- // with the provided ttl. delete if difference is greater than the ttl .
190
+ // Compare the time difference between now and the time at which the file was created
191
+ // with the provided TTL. Delete if the difference is greater than the TTL .
195
192
expired := diff > ttl
196
193
if ! info .IsDir () && info .Mode ()& os .ModeSymlink != os .ModeSymlink {
197
194
if path != localPath && expired {
0 commit comments