Skip to content

Commit ec8a9e4

Browse files
authored
Merge pull request #245 from o2sh/hotfix/remote-branch
Regex matching for remote.url
2 parents fc718b9 + 75def6c commit ec8a9e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/info.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use {
88
colored::{Color, ColoredString, Colorize},
99
git2::Repository,
1010
image::DynamicImage,
11+
regex::Regex,
1112
std::{ffi::OsStr, fmt::Write, fs},
1213
tokio::process::Command,
1314
};
@@ -439,9 +440,11 @@ impl Info {
439440
let mut remote_url = String::new();
440441
let mut repository_name = String::new();
441442

443+
let remote_regex = Regex::new(r"remote\.[a-zA-Z0-9]+\.url").unwrap();
444+
442445
for entry in &config.unwrap().entries(None).unwrap() {
443446
let entry = entry.unwrap();
444-
if let "remote.origin.url" = entry.name().unwrap() {
447+
if remote_regex.is_match(entry.name().unwrap()) {
445448
remote_url = entry.value().unwrap().to_string()
446449
};
447450
}

0 commit comments

Comments
 (0)