diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git_remote_nostr/list.rs | 9 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 2 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/export_keys.rs | 7 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 14 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/login.rs | 7 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/logout.rs | 7 |
6 files changed, 8 insertions, 38 deletions
diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index b802a4a..eba573b 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs | |||
| @@ -33,12 +33,7 @@ pub async fn run_list( | |||
| 33 | repo_ref: &RepoRef, | 33 | repo_ref: &RepoRef, |
| 34 | for_push: bool, | 34 | for_push: bool, |
| 35 | ) -> Result<HashMap<String, HashMap<String, String>>> { | 35 | ) -> Result<HashMap<String, HashMap<String, String>>> { |
| 36 | let nostr_state = | 36 | let nostr_state = (get_state_from_cache(Some(git_repo.get_path()?), repo_ref).await).ok(); |
| 37 | if let Ok(nostr_state) = get_state_from_cache(Some(git_repo.get_path()?), repo_ref).await { | ||
| 38 | Some(nostr_state) | ||
| 39 | } else { | ||
| 40 | None | ||
| 41 | }; | ||
| 42 | 37 | ||
| 43 | let term = console::Term::stderr(); | 38 | let term = console::Term::stderr(); |
| 44 | 39 | ||
| @@ -169,7 +164,7 @@ async fn get_open_and_draft_proposals_state( | |||
| 169 | .as_str(), | 164 | .as_str(), |
| 170 | ); | 165 | ); |
| 171 | } | 166 | } |
| 172 | }; | 167 | } |
| 173 | } | 168 | } |
| 174 | } | 169 | } |
| 175 | } | 170 | } |
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 6113c0a..0cb1107 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -792,7 +792,7 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 792 | ).as_str(), | 792 | ).as_str(), |
| 793 | )?; | 793 | )?; |
| 794 | } | 794 | } |
| 795 | }; | 795 | } |
| 796 | } else { | 796 | } else { |
| 797 | // remote_value oid is not present locally | 797 | // remote_value oid is not present locally |
| 798 | // TODO can we download the remote reference? | 798 | // TODO can we download the remote reference? |
diff --git a/src/bin/ngit/sub_commands/export_keys.rs b/src/bin/ngit/sub_commands/export_keys.rs index 45b1b89..4a32a3a 100644 --- a/src/bin/ngit/sub_commands/export_keys.rs +++ b/src/bin/ngit/sub_commands/export_keys.rs | |||
| @@ -12,12 +12,7 @@ use crate::git::Repo; | |||
| 12 | 12 | ||
| 13 | pub async fn launch() -> Result<()> { | 13 | pub async fn launch() -> Result<()> { |
| 14 | let git_repo_result = Repo::discover().context("failed to find a git repository"); | 14 | let git_repo_result = Repo::discover().context("failed to find a git repository"); |
| 15 | let git_repo = { | 15 | let git_repo = { git_repo_result.ok() }; |
| 16 | match git_repo_result { | ||
| 17 | Ok(git_repo) => Some(git_repo), | ||
| 18 | Err(_) => None, | ||
| 19 | } | ||
| 20 | }; | ||
| 21 | 16 | ||
| 22 | if let Ok((signer_info, source)) = get_signer_info(&git_repo.as_ref(), &None, &None, &None) { | 17 | if let Ok((signer_info, source)) = get_signer_info(&git_repo.as_ref(), &None, &None, &None) { |
| 23 | if let Ok((_, user_ref, source)) = load_existing_login( | 18 | if let Ok((_, user_ref, source)) = load_existing_login( |
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 9c544d6..3c58a52 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -70,21 +70,11 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 70 | 70 | ||
| 71 | let mut client = Client::default(); | 71 | let mut client = Client::default(); |
| 72 | 72 | ||
| 73 | let repo_coordinate = if let Ok(repo_coordinate) = | 73 | let repo_coordinate = (try_and_get_repo_coordinates_when_remote_unknown(&git_repo).await).ok(); |
| 74 | try_and_get_repo_coordinates_when_remote_unknown(&git_repo).await | ||
| 75 | { | ||
| 76 | Some(repo_coordinate) | ||
| 77 | } else { | ||
| 78 | None | ||
| 79 | }; | ||
| 80 | 74 | ||
| 81 | let repo_ref = if let Some(repo_coordinate) = &repo_coordinate { | 75 | let repo_ref = if let Some(repo_coordinate) = &repo_coordinate { |
| 82 | fetching_with_report(git_repo_path, &client, repo_coordinate).await?; | 76 | fetching_with_report(git_repo_path, &client, repo_coordinate).await?; |
| 83 | if let Ok(repo_ref) = get_repo_ref_from_cache(Some(git_repo_path), repo_coordinate).await { | 77 | (get_repo_ref_from_cache(Some(git_repo_path), repo_coordinate).await).ok() |
| 84 | Some(repo_ref) | ||
| 85 | } else { | ||
| 86 | None | ||
| 87 | } | ||
| 88 | } else { | 78 | } else { |
| 89 | None | 79 | None |
| 90 | }; | 80 | }; |
diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs index 06236ec..e76a089 100644 --- a/src/bin/ngit/sub_commands/login.rs +++ b/src/bin/ngit/sub_commands/login.rs | |||
| @@ -32,12 +32,7 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { | |||
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | let git_repo_result = Repo::discover().context("failed to find a git repository"); | 34 | let git_repo_result = Repo::discover().context("failed to find a git repository"); |
| 35 | let git_repo = { | 35 | let git_repo = { git_repo_result.ok() }; |
| 36 | match git_repo_result { | ||
| 37 | Ok(git_repo) => Some(git_repo), | ||
| 38 | Err(_) => None, | ||
| 39 | } | ||
| 40 | }; | ||
| 41 | 36 | ||
| 42 | let (logged_out, log_in_locally_only) = logout(git_repo.as_ref(), command_args.local).await?; | 37 | let (logged_out, log_in_locally_only) = logout(git_repo.as_ref(), command_args.local).await?; |
| 43 | if logged_out || log_in_locally_only { | 38 | if logged_out || log_in_locally_only { |
diff --git a/src/bin/ngit/sub_commands/logout.rs b/src/bin/ngit/sub_commands/logout.rs index 2df96c8..da445b4 100644 --- a/src/bin/ngit/sub_commands/logout.rs +++ b/src/bin/ngit/sub_commands/logout.rs | |||
| @@ -11,12 +11,7 @@ use crate::{ | |||
| 11 | 11 | ||
| 12 | pub async fn launch() -> Result<()> { | 12 | pub async fn launch() -> Result<()> { |
| 13 | let git_repo_result = Repo::discover().context("failed to find a git repository"); | 13 | let git_repo_result = Repo::discover().context("failed to find a git repository"); |
| 14 | let git_repo = { | 14 | let git_repo = { git_repo_result.ok() }; |
| 15 | match git_repo_result { | ||
| 16 | Ok(git_repo) => Some(git_repo), | ||
| 17 | Err(_) => None, | ||
| 18 | } | ||
| 19 | }; | ||
| 20 | logout(git_repo.as_ref()).await | 15 | logout(git_repo.as_ref()).await |
| 21 | } | 16 | } |
| 22 | 17 | ||