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

Pressing Cancel does not stop the search #578

Closed
mdell-seradex opened this issue Oct 29, 2021 · 7 comments
Closed

Pressing Cancel does not stop the search #578

mdell-seradex opened this issue Oct 29, 2021 · 7 comments

Comments

@mdell-seradex
Copy link

Sometimes I start a search, but find that I have the wrong location, or wrong options. I try to cancel it, but it many cases it appears to run to completion instead of stopping.
Often this is not a major pain, but sometimes I try to search everywhere (e.g. C:), so being able to cancel when doing that would be very helpful.

@doug24
Copy link
Contributor

doug24 commented Oct 30, 2021

I don't know what would cause this, when I test it, the search stops very quickly. Can you share the file search settings and search pattern you are using? Maybe it has something to do with some option that I don't have set.

@mdell-seradex
Copy link
Author

mdell-seradex commented Oct 30, 2021

Is this what you are looking for?
Screenshot 2021-10-30 161239

Let me know if I can provide any assistance.

@doug24
Copy link
Contributor

doug24 commented Oct 31, 2021

I see now, the problem is enabling Use .gitignore from the drive root - dnGrep is going to search the entire drive for .gitignore files before it starts searching for files, and there wasn't a Cancel check in that code. I can fix that.

@mdell-seradex
Copy link
Author

mdell-seradex commented Oct 31, 2021

Interesting. I don't think I ever enabled that.
That sounds like it will slow down the search considerably. I'd think it would be faster doing it during the main search process, but I have no clue how that would affect things. I would think that this file would not affect parent folders, so it would make sense to me that it could be included, but that is just me guessing. 🙂
Does the "Use .gitignore" option also look at ".tfignore" and ".hgignore" files (TFS and Mercurial, respectively)? I don't use Mercurial, but I do use TFS (AzureDevOps). My understanding is that ".tfignore" and ".gitignore" are very similar files.

@doug24
Copy link
Contributor

doug24 commented Oct 31, 2021

Fixed in Released in 2.9.428

@doug24
Copy link
Contributor

doug24 commented Oct 31, 2021

I think the optimum way to use .gitignore is if the search start directory is a git repository, in a git repository, or possibly one level up if you want to include multiple git repositories. It does not work well when searching from the root of the drive, or from a network drive because dnGrep needs to each the everywhere to find any git repositories before it can begin the search.

Searching for .gitignore starts looking at the starting point of the overall search, goes down the tree, and if not found goes up the parent folders to the root. So if your search begins at the root, it will search the entire drive.

I added a status message when dnGrep is looking for .gitignore files to give users a indication of the cost of the operation.

Sometimes it is faster, and sometimes slower using .gitignore. When searching a git repository, I find it very useful to include those file filters. No, it would not affect any parent directories above the git repository.

The 'Use .gitignore' is just for git, not TFS or Mercurial, but they could potentially be added in the future. The way dnGrep implements this feature is to run a git command, asking git for the list of files and directories to ignore. I didn't want to try to implement all the parsing rules and then build the exclusion list internally - it's far easier to just ask git to do it.

@mdell-seradex
Copy link
Author

Thank you for the clarity.
I don't actually use git either, so I think I will simply turn off the option, but at least I understand a bit better now, and you have improved the app using my feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants