fix(ignore, fs): allow loading ignore patterns behind symlink (fixes #10785) (#10786)

The recent change to disallow following symlinks by default conflicts
with the expected behavior of .stignore. This adds a new flag which may
be passed to OpenFile to skip default symlink-forbidding open flag.

---------

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-07-16 09:19:13 +08:00
committed by GitHub
parent d4cffd848e
commit c1d8045d86
6 changed files with 60 additions and 5 deletions
+2 -2
View File
@@ -357,8 +357,8 @@ func hashPatterns(patterns []Pattern) string {
return hex.EncodeToString(h.Sum(nil))
}
func loadIgnoreFile(fs fs.Filesystem, file string) (fs.File, fs.FileInfo, error) {
fd, err := fs.Open(file)
func loadIgnoreFile(ffs fs.Filesystem, file string) (fs.File, fs.FileInfo, error) {
fd, err := ffs.OpenFile(file, fs.OptReadOnly|fs.OptFollow, 0o666)
if err != nil {
return fd, nil, err
}