diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-04 15:36:17 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-04 15:36:17 +0000 |
| commit | e00f712fb09d2a55fbfd36696f3725bc44c140f5 (patch) | |
| tree | d937f121f70050bbda40830df56e952cbeb5860c /src/bin | |
| parent | d2478dbca6c5d3f61331ceabe20c6d9315cd6840 (diff) | |
fix: `ngit` load correct repo address
git-remote-nostr is always called with a nostr remote that specifies
a single repository coordinate whereas `ngit` commands need to
discover this.
this change moves from getting this value from the following places
in priority order:
1. git config item `nostr.repo`
2. first nostr remote discovered
2. maintainers.yaml
3. prompt the user
to:
1. nostr remote - if multiple, prompt the user to select
2. git config item `nostr.repo`
3. maintainers.yaml - removing the legacy format
4. prompt the user - now with support for nostr remote format
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 4 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/list.rs | 4 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 9d87ba2..6fc1ec4 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -14,7 +14,7 @@ use crate::{ | |||
| 14 | login, | 14 | login, |
| 15 | repo_ref::{ | 15 | repo_ref::{ |
| 16 | extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, | 16 | extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, |
| 17 | try_and_get_repo_coordinates, RepoRef, | 17 | try_and_get_repo_coordinates_when_remote_unknown, RepoRef, |
| 18 | }, | 18 | }, |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| @@ -61,7 +61,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 61 | let mut client = Client::default(); | 61 | let mut client = Client::default(); |
| 62 | 62 | ||
| 63 | let repo_coordinate = if let Ok(repo_coordinate) = | 63 | let repo_coordinate = if let Ok(repo_coordinate) = |
| 64 | try_and_get_repo_coordinates(&git_repo, &client, false).await | 64 | try_and_get_repo_coordinates_when_remote_unknown(&git_repo).await |
| 65 | { | 65 | { |
| 66 | Some(repo_coordinate) | 66 | Some(repo_coordinate) |
| 67 | } else { | 67 | } else { |
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs index 60f8e46..f79e284 100644 --- a/src/bin/ngit/sub_commands/list.rs +++ b/src/bin/ngit/sub_commands/list.rs | |||
| @@ -19,7 +19,7 @@ use crate::{ | |||
| 19 | commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter, | 19 | commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter, |
| 20 | patch_supports_commit_ids, | 20 | patch_supports_commit_ids, |
| 21 | }, | 21 | }, |
| 22 | repo_ref::get_repo_coordinates, | 22 | repo_ref::get_repo_coordinates_when_remote_unknown, |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | #[allow(clippy::too_many_lines)] | 25 | #[allow(clippy::too_many_lines)] |
| @@ -33,7 +33,7 @@ pub async fn launch() -> Result<()> { | |||
| 33 | 33 | ||
| 34 | let client = Client::default(); | 34 | let client = Client::default(); |
| 35 | 35 | ||
| 36 | let repo_coordinates = get_repo_coordinates(&git_repo, &client).await?; | 36 | let repo_coordinates = get_repo_coordinates_when_remote_unknown(&git_repo).await?; |
| 37 | 37 | ||
| 38 | fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; | 38 | fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; |
| 39 | 39 | ||
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index 6c9d8eb..bc4d18a 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -20,7 +20,7 @@ use crate::{ | |||
| 20 | git::{identify_ahead_behind, Repo, RepoActions}, | 20 | git::{identify_ahead_behind, Repo, RepoActions}, |
| 21 | git_events::{event_is_patch_set_root, event_tag_from_nip19_or_hex}, | 21 | git_events::{event_is_patch_set_root, event_tag_from_nip19_or_hex}, |
| 22 | login, | 22 | login, |
| 23 | repo_ref::get_repo_coordinates, | 23 | repo_ref::get_repo_coordinates_when_remote_unknown, |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | #[derive(Debug, clap::Args)] | 26 | #[derive(Debug, clap::Args)] |
| @@ -54,7 +54,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re | |||
| 54 | 54 | ||
| 55 | let mut client = Client::default(); | 55 | let mut client = Client::default(); |
| 56 | 56 | ||
| 57 | let repo_coordinates = get_repo_coordinates(&git_repo, &client).await?; | 57 | let repo_coordinates = get_repo_coordinates_when_remote_unknown(&git_repo).await?; |
| 58 | 58 | ||
| 59 | if !no_fetch { | 59 | if !no_fetch { |
| 60 | fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; | 60 | fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; |