diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-27 18:00:54 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-27 18:01:31 +0200 |
| commit | 5859dcdc00151efdc25e598a41bff622d19ba23a (patch) | |
| tree | fbe2412437b1ab87f50131ca1a66350bf05c20ed /internal/llm | |
| parent | 3c2b0f4dd03f4b9d366a4667608390923618bb0c (diff) | |
| download | opencode-5859dcdc00151efdc25e598a41bff622d19ba23a.tar.gz opencode-5859dcdc00151efdc25e598a41bff622d19ba23a.zip | |
small glob fixes
Diffstat (limited to 'internal/llm')
| -rw-r--r-- | internal/llm/tools/glob.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/internal/llm/tools/glob.go b/internal/llm/tools/glob.go index dd224267c..d62b3a430 100644 --- a/internal/llm/tools/glob.go +++ b/internal/llm/tools/glob.go @@ -146,7 +146,6 @@ func globWithRipgrep( pattern, searchRoot string, limit int, ) ([]string, error) { - if searchRoot == "" { searchRoot = "." } @@ -201,14 +200,7 @@ func globWithRipgrep( } func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, error) { - if !strings.HasPrefix(pattern, "/") && !strings.HasPrefix(pattern, searchPath) { - if !strings.HasSuffix(searchPath, "/") { - searchPath += "/" - } - pattern = searchPath + pattern - } - - fsys := os.DirFS("/") + fsys := os.DirFS(searchPath) relPattern := strings.TrimPrefix(pattern, "/") @@ -227,7 +219,11 @@ func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, return nil // Skip files we can't access } - absPath := "/" + path // Restore absolute path + absPath := path // Restore absolute path + if !strings.HasPrefix(absPath, searchPath) { + absPath = filepath.Join(searchPath, absPath) + } + matches = append(matches, fileInfo{ path: absPath, modTime: info.ModTime(), |
