New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache evaluated directories in isExcludedByFile #1326
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1326 +/- ##
=========================================
- Coverage 51.98% 46.6% -5.38%
=========================================
Files 134 134
Lines 13108 13123 +15
=========================================
- Hits 6814 6116 -698
- Misses 5463 6224 +761
+ Partials 831 783 -48
Continue to review full report at Codecov.
|
cmd/restic/exclude.go
Outdated
if tagFilename == "" { | ||
return false | ||
} | ||
dir, base := filepath.Split(filename) | ||
if base == tagFilename { | ||
return false // do not exclude the tagfile itself | ||
} | ||
if rc != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice if this were a method on the rc
struct, and it should also work if rc
is nil, so we can abstract that away, like rejected, ok := rc.Get(dir); if ok { return rejected }
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. The mutex must remain locked until the function returnes, though, so I wrap its Lock()
and Unlock()
methods, too.
cmd/restic/exclude.go
Outdated
} | ||
|
||
rejected := isDirExcludedByFile(dir, tagFilename, header) | ||
if rc != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too, e.g. rc.Store(dir, rejected)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fd0 The changes you requested have been implemented.
Cache evaluated directories in isExcludedByFile
Fixes #1271.