-
Notifications
You must be signed in to change notification settings - Fork 289
More idiomatic way to fetch repository remote URL #1516
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
Conversation
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.
LGTM! But, just to confirm, we're now changing from always falling back to an empty string to now distinguishing between "no remote found" vs "invalid remote found", right?
src/info/url.rs
Outdated
if let Some(url) = remote.url(gix::remote::Direction::Push) { | ||
Ok(format_url(&url.to_string(), hide_token, http_url)) | ||
} else { | ||
Ok(String::new()) |
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.
IDK if you have a preference, but this can also be written with Option::map
and Option::unwrap_or_default
I think.
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.
done
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.
Oops, hit submit before switching to "approve"
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.
LGTM!
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [o2sh/onefetch](https://github.com/o2sh/onefetch) | minor | `2.23.1` -> `2.24.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>o2sh/onefetch (o2sh/onefetch)</summary> ### [`v2.24.0`](https://github.com/o2sh/onefetch/blob/HEAD/CHANGELOG.md#2240-2025-04-12) [Compare Source](o2sh/onefetch@2.23.1...2.24.0) ##### New Features - add language support for Lean by [@​foxyseta](https://github.com/foxyseta) in o2sh/onefetch#1509 - add language support for Typst by [@​foxyseta](https://github.com/foxyseta) in o2sh/onefetch#1508 - add language support for Razor by [@​SrS2225a](https://github.com/SrS2225a) in o2sh/onefetch#1521 ##### Chores - more idiomatic way to fetch HEAD refs by [@​o2sh](https://github.com/o2sh) in o2sh/onefetch#1515 - more idiomatic way to fetch repository remote URL by [@​o2sh](https://github.com/o2sh) in o2sh/onefetch#1516 - update holyc language logo by [@​o2sh](https://github.com/o2sh) in o2sh/onefetch#1543 - update wiki powershell-snippet by [@​FallenDeity](https://github.com/FallenDeity) in o2sh/onefetch#1542 - add nix local setup [@​Sk7Str1p3](https://github.com/Sk7Str1p3) in o2sh/onefetch#1549 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xMS4yIiwidXBkYXRlZEluVmVyIjoiNDAuMTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Tried to simplify the logic to get the repository remote URL