-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add vcsh locate
to locate repo holding a file
#268
base: main
Are you sure you want to change the base?
Conversation
This adds the `locate` subcommand, which takes an existing file and returns the repository that's tracking the file. Signed-off-by: martin f. krafft <[email protected]>
Looks like the testing framework is broken. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to contribute this. I've wanted some function like this many times!
What happens if more than one repo tracks a file? (I have several instances of this for various reasons.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the other couple comments, I'm wonding if this isn't an inefficient way to get the job done. I know git ls-files
supports glob matching. That might be faster that listing everything and grepping. Did you check that?
Lastly does this cover the case of things behind spares checkouts?
fatal "'$VCSH_COMMAND_PARAMETER' does not exist" 1 | ||
fi | ||
for VCSH_REPO_NAME in $(list); do | ||
if get_files "$VCSH_COMMAND_PARAMETER" | @GREP@ -q .; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This grep
feels very superfluous. Did you look into what the return being given are and if they might suffice for this logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I resolved the merge conflicts with the default branch, but this still needs some confirmation on a couple points.
- How it handles multiple positives.
- Whether there is a simpler way to code it up, see L538 comment and earlier concern about globbing/iterating everything.
This adds the
locate
subcommand, which takes an existing file andreturns the repository that's tracking the file.
Signed-off-by: martin f. krafft [email protected]