@@ -146,7 +146,6 @@ func globWithRipgrep(
146 pattern, searchRoot string,
146 pattern, searchRoot string,
147 limit int,
147 limit int,
148) ([]string, error) {
148) ([]string, error) {
150 if searchRoot == "" {
149 if searchRoot == "" {
151 searchRoot = "."
150 searchRoot = "."
@@ -201,14 +200,7 @@ func globWithRipgrep(
203func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, error) {
202func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, error) {
204− if !strings.HasPrefix(pattern, "/") && !strings.HasPrefix(pattern, searchPath) {
205− if !strings.HasSuffix(searchPath, "/") {
208− pattern = searchPath + pattern
211− fsys := os.DirFS("/")
203+ fsys := os.DirFS(searchPath)
213 relPattern := strings.TrimPrefix(pattern, "/")
205 relPattern := strings.TrimPrefix(pattern, "/")
@@ -227,7 +219,11 @@ func globWithDoublestar(pattern, searchPath string, limit int) ([]string, bool,
227 return nil // Skip files we can't access
219 return nil // Skip files we can't access
230− absPath := "/" + path // Restore absolute path
222+ absPath := path // Restore absolute path
223+ if !strings.HasPrefix(absPath, searchPath) {
224+ absPath = filepath.Join(searchPath, absPath)
231 matches = append(matches, fileInfo{
227 matches = append(matches, fileInfo{
232 path: absPath,
228 path: absPath,
233 modTime: info.ModTime(),
229 modTime: info.ModTime(),