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

Run Onefetch in any of the repo's subfolders #129

Closed
o2sh opened this issue Oct 29, 2019 · 6 comments
Closed

Run Onefetch in any of the repo's subfolders #129

o2sh opened this issue Oct 29, 2019 · 6 comments
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed

Comments

@o2sh
Copy link
Owner

o2sh commented Oct 29, 2019

As suggested by @davep in #100 , It would be handy if the tool could work anywhere within a git repo, rather than only in the root of the repo.

The idea would be to search for the .git folder in any of the parent directories as a marker for the root of the repo and to execute onefetch on it 👍

If it fails to find it, the error message should be:

fatal: not a git repository (or any of the parent directories): .git

@o2sh o2sh added enhancement New feature or request help wanted Extra attention is needed hacktoberfest labels Oct 29, 2019
@spenserblack
Copy link
Collaborator

Considering git -C path/to/repo/subfolder/ <git command> works fine, this could also be solved by switching git2::Repository usage with std::process::Command usage.

@rockisch
Copy link
Contributor

Seems like the git2 package supports this kind of usage with the discover method:
https://docs.rs/git2/0.10.1/git2/struct.Repository.html#method.discover

I'm opening a PR for that, although not sure I should use the error message on the description, since that's not how the other error messages are formatted.

@spenserblack
Copy link
Collaborator

Closed by #132
Thanks, @rockisch!

@o2sh o2sh reopened this Oct 30, 2019
@o2sh
Copy link
Owner Author

o2sh commented Oct 30, 2019

The function get_project_license doesn't work in subfolders

@rockisch
Copy link
Contributor

Damn, I ran a little test but didn't check the individual fields, my bad.

I think git2::Repository has some kind of method to get the root dir of the repo. I can check later when I'm home.

@davep
Copy link

davep commented Nov 11, 2019

Updated locally and it's working great. Just wanted to say thanks for doing this. Very much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants