Skip to content

Commit

Permalink
Merge pull request #245 from o2sh/hotfix/remote-branch
Browse files Browse the repository at this point in the history
Regex matching for remote.url
  • Loading branch information
o2sh authored Oct 9, 2020
2 parents fc718b9 + 75def6c commit ec8a9e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use {
colored::{Color, ColoredString, Colorize},
git2::Repository,
image::DynamicImage,
regex::Regex,
std::{ffi::OsStr, fmt::Write, fs},
tokio::process::Command,
};
Expand Down Expand Up @@ -439,9 +440,11 @@ impl Info {
let mut remote_url = String::new();
let mut repository_name = String::new();

let remote_regex = Regex::new(r"remote\.[a-zA-Z0-9]+\.url").unwrap();

for entry in &config.unwrap().entries(None).unwrap() {
let entry = entry.unwrap();
if let "remote.origin.url" = entry.name().unwrap() {
if remote_regex.is_match(entry.name().unwrap()) {
remote_url = entry.value().unwrap().to_string()
};
}
Expand Down

0 comments on commit ec8a9e4

Please sign in to comment.