upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/lib/git
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/git')
-rw-r--r--src/lib/git/mod.rs7
-rw-r--r--src/lib/git/nostr_url.rs8
2 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/git/mod.rs b/src/lib/git/mod.rs
index 5bdb30a..464990b 100644
--- a/src/lib/git/mod.rs
+++ b/src/lib/git/mod.rs
@@ -888,7 +888,7 @@ pub fn save_git_config_item(git_repo: &Option<&Repo>, item: &str, value: &str) -
888 git2::Config::open_default()? 888 git2::Config::open_default()?
889 .open_global()? 889 .open_global()?
890 .set_str(item, value) 890 .set_str(item, value)
891 .context(format!("failed to set global git config item {}", item)) 891 .context(format!("failed to set global git config item {item}"))
892 } 892 }
893} 893}
894 894
@@ -901,10 +901,7 @@ pub fn remove_git_config_item(git_repo: &Option<&Repo>, item: &str) -> Result<bo
901 git2::Config::open_default()? 901 git2::Config::open_default()?
902 .open_global()? 902 .open_global()?
903 .remove(item) 903 .remove(item)
904 .context(format!( 904 .context(format!("failed to remove existing git config item {item}"))?;
905 "failed to remove existing git config item {}",
906 item
907 ))?;
908 Ok(true) 905 Ok(true)
909 } 906 }
910} 907}
diff --git a/src/lib/git/nostr_url.rs b/src/lib/git/nostr_url.rs
index a9b08eb..e9b482f 100644
--- a/src/lib/git/nostr_url.rs
+++ b/src/lib/git/nostr_url.rs
@@ -71,13 +71,13 @@ impl fmt::Display for NostrUrlDecoded {
71 } 71 }
72 write!(f, "nostr://")?; 72 write!(f, "nostr://")?;
73 if let Some(user) = &self.user { 73 if let Some(user) = &self.user {
74 write!(f, "{}@", user)?; 74 write!(f, "{user}@")?;
75 } 75 }
76 if let Some(protocol) = &self.protocol { 76 if let Some(protocol) = &self.protocol {
77 write!(f, "{}/", protocol)?; 77 write!(f, "{protocol}/")?;
78 } 78 }
79 if let Some(nip05) = &self.nip05 { 79 if let Some(nip05) = &self.nip05 {
80 write!(f, "{}/", nip05)?; 80 write!(f, "{nip05}/")?;
81 } else { 81 } else {
82 write!(f, "{}/", self.coordinate.public_key.to_bech32().unwrap())?; 82 write!(f, "{}/", self.coordinate.public_key.to_bech32().unwrap())?;
83 } 83 }
@@ -454,7 +454,7 @@ impl CloneUrl {
454 format!("{}@", user.as_deref().unwrap_or("git")).as_str(), 454 format!("{}@", user.as_deref().unwrap_or("git")).as_str(),
455 ); 455 );
456 if url.port().is_some() { 456 if url.port().is_some() {
457 formatted_url = format!("ssh://{}", formatted_url); 457 formatted_url = format!("ssh://{formatted_url}");
458 } else { 458 } else {
459 formatted_url = replace_first_occurrence(&formatted_url, '/', ':'); 459 formatted_url = replace_first_occurrence(&formatted_url, '/', ':');
460 } 460 }