-
Notifications
You must be signed in to change notification settings - Fork 284
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
More idiomatic way to fetch repository remote URL #1516
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!
Tried to simplify the logic to get the repository remote URL