Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of search results is not predictable #636

Closed
kumar303 opened this issue Oct 11, 2017 · 1 comment
Closed

Order of search results is not predictable #636

kumar303 opened this issue Oct 11, 2017 · 1 comment
Labels
duplicate An issue that is duplicative of another.

Comments

@kumar303
Copy link

If I re-run the same search on the same codebase, sometimes the results are returned in a different order.

For example, this makes it hard to do a refactoring where I'm renaming a function and I need to re-run rg after fixing each file -- i.e. I can lose my place in the sequence.

$ rg --version
ripgrep 0.6.0
-AVX -SIMD
@BurntSushi
Copy link
Owner

BurntSushi commented Oct 11, 2017

Duplicate of #152

Summary: Technically, this bug exists in any recursive directory searchers that doesn't explicitly sort, but if traversal is single threaded, then in practice, you get deterministic results (but it's not guaranteed). However, ripgrep parallelizes traversal itself, which makes the output far less deterministic than it would be otherwise.

TL;DR - Pick one: speed or determinism. Speed is the default. If you want determinism, then use the --sort-files flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate An issue that is duplicative of another.
Projects
None yet
Development

No branches or pull requests

2 participants