From c94ebe9737d18b73e34e82026b9fd48c56a3174a Mon Sep 17 00:00:00 2001 From: Ossama Hjaji Date: Thu, 8 Oct 2020 20:49:14 +0200 Subject: [PATCH 1/2] Regex matching for remote.url --- src/info.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/info.rs b/src/info.rs index 2a50c8936..96e8c630b 100644 --- a/src/info.rs +++ b/src/info.rs @@ -8,6 +8,7 @@ use { colored::{Color, ColoredString, Colorize}, git2::Repository, image::DynamicImage, + regex::Regex, std::{ffi::OsStr, fmt::Write, fs}, tokio::process::Command, }; @@ -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() }; } From 75def6c74e0a2e0595e78f776a7a694e887690b7 Mon Sep 17 00:00:00 2001 From: Spenser Black Date: Fri, 9 Oct 2020 10:42:40 -0400 Subject: [PATCH 2/2] Match on literal . --- src/info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.rs b/src/info.rs index 96e8c630b..fb98a9768 100644 --- a/src/info.rs +++ b/src/info.rs @@ -440,7 +440,7 @@ 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(); + 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();