Fix search when REPO_PATH contains a dot-dir#82
Merged
Conversation
REPO_PATH had a dot-dirREPO_PATH contains a dot-dir
pcrockett
reviewed
Oct 27, 2024
Comment on lines
+14
to
+17
| find "$repo_path" -type d | | ||
| grep -v "$repo_path.*/\." | | ||
| grep --color=always "$text" | | ||
| sed "s#${repo_path}/#${prefix}#g" |
There was a problem hiding this comment.
Probably works fine for 99% of people, though I'm not super excited about the repo path being treated as a regex. Perhaps slightly more technically correct:
Suggested change
| find "$repo_path" -type d | | |
| grep -v "$repo_path.*/\." | | |
| grep --color=always "$text" | | |
| sed "s#${repo_path}/#${prefix}#g" | |
| path_length=$((${#repo_path}+2)) | |
| find "$repo_path" -type d | | |
| cut --characters "$path_length-" | | |
| grep -v -F "/." | | |
| grep --color=always "$text" | | |
| sed "s#^#${prefix}#" |
Owner
Author
There was a problem hiding this comment.
I am not also not crazy about this excessive piping.
Perhaps we should search for dirs that contain main files instead of searching for dirs?
|
I had a similar thought, would also be a good approach.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc #81