-
-
Notifications
You must be signed in to change notification settings - Fork 22
Fix exclude-pattern handling to avoid preserving empty directories #166
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
Conversation
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
|
@copilot provide a detailed report of the regression. explain what happened to cause the regression. |
1 similar comment
|
@copilot provide a detailed report of the regression. explain what happened to cause the regression. |
The regression came from how CopyDir handled patterns ending in |
The regression was caused by |
|
@copilot what change in |
CopyDir was changed to rely solely on |
|
@copilot what was the git commit and the git diff for the |
The regression came in commit 247c6d4 (“cleanup”). The hunk in @@ func copyFileObjectHandler(... excludePatterns []string ...){
- // previous handling skipped directories when the pattern matched the dir path
- if strings.HasPrefix(path, xpatternDir) { isIgnored = true; break }
+ var isIgnored bool
+ for _, xpattern := range excludePatterns {
+ found, err := doublestar.Match(xpattern, path)
+ if err != nil {
+ log.Warnf("copyFileObjectHandler - [%v] excludePatterns Match error - %v\n", path, err)
+ continue
+ }
+ if found {
+ isIgnored = true
+ break
+ }
+ }That change meant a pattern like |
|
@copilot explain how your enhancement fixes the problem. you only added |
The fix reintroduced an explicit directory-level check in |
kcq
left a comment
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.
ok
What
/**as excluding the directory itself infsutil.CopyDir, normalizing paths withfilepath.Clean.Why
doublestar.Matchmeant/foo/**skipped children but still created the/foodirectory, leaving empty dirs; this restores the pre-1.41.8 behavior.How Tested
go test ./pkg/util/fsutilOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.