diff options
Diffstat (limited to 'src/lib/repo_ref.rs')
| -rw-r--r-- | src/lib/repo_ref.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs index 8705597..38f6774 100644 --- a/src/lib/repo_ref.rs +++ b/src/lib/repo_ref.rs | |||
| @@ -241,12 +241,12 @@ impl RepoRef { | |||
| 241 | self.nostr_git_url = Some(nostr_git_url) | 241 | self.nostr_git_url = Some(nostr_git_url) |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | pub fn to_nostr_git_url(&self, git_repo: &Option<&Repo>) -> String { | 244 | pub fn to_nostr_git_url(&self, git_repo: &Option<&Repo>) -> NostrUrlDecoded { |
| 245 | if let Some(nostr_git_url) = &self.nostr_git_url { | 245 | if let Some(nostr_git_url) = &self.nostr_git_url { |
| 246 | return nostr_git_url.original_string.clone(); | 246 | return nostr_git_url.clone(); |
| 247 | } | 247 | } |
| 248 | let c = self.coordinate_with_hint(); | 248 | let c = self.coordinate_with_hint(); |
| 249 | format!("{}", NostrUrlDecoded { | 249 | NostrUrlDecoded { |
| 250 | original_string: String::new(), | 250 | original_string: String::new(), |
| 251 | nip05: use_nip05_git_config_cache_to_find_nip05_from_public_key( | 251 | nip05: use_nip05_git_config_cache_to_find_nip05_from_public_key( |
| 252 | &c.public_key, | 252 | &c.public_key, |
| @@ -256,7 +256,7 @@ impl RepoRef { | |||
| 256 | coordinate: c, | 256 | coordinate: c, |
| 257 | protocol: None, | 257 | protocol: None, |
| 258 | user: None, | 258 | user: None, |
| 259 | }) | 259 | } |
| 260 | } | 260 | } |
| 261 | } | 261 | } |
| 262 | 262 | ||
| @@ -460,12 +460,8 @@ fn set_or_create_git_remote_with_nostr_url( | |||
| 460 | repo_ref: &RepoRef, | 460 | repo_ref: &RepoRef, |
| 461 | git_repo: &Repo, | 461 | git_repo: &Repo, |
| 462 | ) -> Result<()> { | 462 | ) -> Result<()> { |
| 463 | let url = repo_ref.to_nostr_git_url(&Some(git_repo)); | 463 | let url = repo_ref.to_nostr_git_url(&Some(git_repo)).to_string(); |
| 464 | if git_repo | 464 | if git_repo.git_repo.remote_set_url(name, &url).is_err() { |
| 465 | .git_repo | ||
| 466 | .remote_set_url(name, &repo_ref.to_nostr_git_url(&Some(git_repo))) | ||
| 467 | .is_err() | ||
| 468 | { | ||
| 469 | git_repo.git_repo.remote(name, &url)?; | 465 | git_repo.git_repo.remote(name, &url)?; |
| 470 | } | 466 | } |
| 471 | eprintln!("set git remote \"{name}\" to {url}"); | 467 | eprintln!("set git remote \"{name}\" to {url}"); |