diff options
Diffstat (limited to 'src/bin/ngit')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 6fc1ec4..c9c8873 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | use std::{collections::HashMap, str::FromStr}; | 1 | use std::collections::HashMap; |
| 2 | 2 | ||
| 3 | use anyhow::{Context, Result}; | 3 | use anyhow::{Context, Result}; |
| 4 | use console::Style; | 4 | use console::Style; |
| @@ -442,7 +442,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 442 | .map(std::string::ToString::to_string) | 442 | .map(std::string::ToString::to_string) |
| 443 | .collect::<Vec<String>>(); | 443 | .collect::<Vec<String>>(); |
| 444 | 444 | ||
| 445 | prompt_to_set_nostr_url_as_origin(&repo_ref, &git_repo)?; | 445 | prompt_to_set_nostr_url_as_origin(&repo_ref, &git_repo).await?; |
| 446 | 446 | ||
| 447 | // TODO: if no state event exists and there is currently a remote called | 447 | // TODO: if no state event exists and there is currently a remote called |
| 448 | // "origin", automtically push rather than waiting for the next commit | 448 | // "origin", automtically push rather than waiting for the next commit |
| @@ -483,7 +483,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 483 | Ok(()) | 483 | Ok(()) |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | fn prompt_to_set_nostr_url_as_origin(repo_ref: &RepoRef, git_repo: &Repo) -> Result<()> { | 486 | async fn prompt_to_set_nostr_url_as_origin(repo_ref: &RepoRef, git_repo: &Repo) -> Result<()> { |
| 487 | println!( | 487 | println!( |
| 488 | "starting from your next commit, when you `git push` to a remote that uses your nostr url, it will store your repository state on nostr and update the state of the git server(s) you just listed." | 488 | "starting from your next commit, when you `git push` to a remote that uses your nostr url, it will store your repository state on nostr and update the state of the git server(s) you just listed." |
| 489 | ); | 489 | ); |
| @@ -493,7 +493,9 @@ fn prompt_to_set_nostr_url_as_origin(repo_ref: &RepoRef, git_repo: &Repo) -> Res | |||
| 493 | 493 | ||
| 494 | if let Ok(origin_remote) = git_repo.git_repo.find_remote("origin") { | 494 | if let Ok(origin_remote) = git_repo.git_repo.find_remote("origin") { |
| 495 | if let Some(origin_url) = origin_remote.url() { | 495 | if let Some(origin_url) = origin_remote.url() { |
| 496 | if let Ok(nostr_url) = NostrUrlDecoded::from_str(origin_url) { | 496 | if let Ok(nostr_url) = |
| 497 | NostrUrlDecoded::parse_and_resolve(origin_url, &Some(git_repo)).await | ||
| 498 | { | ||
| 497 | if nostr_url.coordinate.identifier == repo_ref.identifier { | 499 | if nostr_url.coordinate.identifier == repo_ref.identifier { |
| 498 | if nostr_url.coordinate.public_key == repo_ref.trusted_maintainer { | 500 | if nostr_url.coordinate.public_key == repo_ref.trusted_maintainer { |
| 499 | return Ok(()); | 501 | return Ok(()); |