@@ -146,7 +146,6 @@ func globWithRipgrep(
146146 pattern, searchRoot string,
147147 limit int,
148148) ([]string, error) {
149−
150149 if searchRoot == "" {
151150 searchRoot = "."
152151 }
@@ -201,14 +200,7 @@ func globWithRipgrep(
201200}
202201
203202func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, error) {
204− if !strings.HasPrefix(pattern, "/") && !strings.HasPrefix(pattern, searchPath) {
205− if !strings.HasSuffix(searchPath, "/") {
206− searchPath += "/"
207− }
208− pattern = searchPath + pattern
209− }
210−
211− fsys := os.DirFS("/")
203+ fsys := os.DirFS(searchPath)
212204
213205 relPattern := strings.TrimPrefix(pattern, "/")
214206
@@ -227,7 +219,11 @@ func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool,
227219 return nil // Skip files we can't access
228220 }
229221
230− absPath := "/" + path // Restore absolute path
222+ absPath := path // Restore absolute path
223+ if !strings.HasPrefix(absPath, searchPath) {
224+ absPath = filepath.Join(searchPath, absPath)
225+ }
226+
231227 matches = append(matches, fileInfo{
232228 path: absPath,
233229 modTime: info.ModTime(),