Skip to content

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

Merged
merged 2 commits into from
Jan 25, 2025
Merged

Conversation

o2sh
Copy link
Owner

@o2sh o2sh commented Jan 24, 2025

Tried to simplify the logic to get the repository remote URL

@o2sh o2sh added the refactor label Jan 24, 2025
@o2sh o2sh requested a review from Byron January 24, 2025 22:08
Copy link
Collaborator

@spenserblack spenserblack left a 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
Comment on lines 26 to 29
if let Some(url) = remote.url(gix::remote::Direction::Push) {
Ok(format_url(&url.to_string(), hide_token, http_url))
} else {
Ok(String::new())
Copy link
Collaborator

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@spenserblack spenserblack left a 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"

Copy link
Collaborator

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@o2sh o2sh merged commit e0fd7fa into main Jan 25, 2025
4 checks passed
@o2sh o2sh deleted the chore/repo-url-refactor branch January 25, 2025 22:35
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 10, 2025
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 [@&#8203;foxyseta](https://github.com/foxyseta) in o2sh/onefetch#1509
-   add language support for Typst by [@&#8203;foxyseta](https://github.com/foxyseta) in o2sh/onefetch#1508
-   add language support for Razor by [@&#8203;SrS2225a](https://github.com/SrS2225a) in o2sh/onefetch#1521

##### Chores

-   more idiomatic way to fetch HEAD refs by [@&#8203;o2sh](https://github.com/o2sh) in o2sh/onefetch#1515
-   more idiomatic way to fetch repository remote URL by [@&#8203;o2sh](https://github.com/o2sh) in o2sh/onefetch#1516
-   update holyc language logo by [@&#8203;o2sh](https://github.com/o2sh) in o2sh/onefetch#1543
-   update wiki powershell-snippet by [@&#8203;FallenDeity](https://github.com/FallenDeity) in o2sh/onefetch#1542
-   add nix local setup [@&#8203;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-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants