summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-27 18:00:54 +0200
committerKujtim Hoxha <[email protected]>2025-04-27 18:01:31 +0200
commit5859dcdc00151efdc25e598a41bff622d19ba23a (patch)
treefbe2412437b1ab87f50131ca1a66350bf05c20ed /internal
parent3c2b0f4dd03f4b9d366a4667608390923618bb0c (diff)
downloadopencode-5859dcdc00151efdc25e598a41bff622d19ba23a.tar.gz
opencode-5859dcdc00151efdc25e598a41bff622d19ba23a.zip
small glob fixes
Diffstat (limited to 'internal')
-rw-r--r--internal/llm/tools/glob.go16
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(),