diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 0f6a77c..acc86fa 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -169,7 +169,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 169 | let mut maintainers_string = if !args.other_maintainers.is_empty() { | 169 | let mut maintainers_string = if !args.other_maintainers.is_empty() { |
| 170 | [args.other_maintainers.clone()].concat().join(" ") | 170 | [args.other_maintainers.clone()].concat().join(" ") |
| 171 | } else if repo_ref.is_none() && repo_config_result.is_err() { | 171 | } else if repo_ref.is_none() && repo_config_result.is_err() { |
| 172 | signer.get_public_key().await?.to_bech32()? | 172 | user_ref.public_key.to_bech32()? |
| 173 | } else { | 173 | } else { |
| 174 | let maintainers = if let Ok(config) = &repo_config_result { | 174 | let maintainers = if let Ok(config) = &repo_config_result { |
| 175 | config.maintainers.clone() | 175 | config.maintainers.clone() |
| @@ -182,7 +182,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 182 | .collect() | 182 | .collect() |
| 183 | } else { | 183 | } else { |
| 184 | //unreachable | 184 | //unreachable |
| 185 | vec![signer.get_public_key().await?.to_bech32()?] | 185 | vec![user_ref.public_key.to_bech32()?] |
| 186 | }; | 186 | }; |
| 187 | // add current user if not present | 187 | // add current user if not present |
| 188 | if maintainers.iter().any(|m| { | 188 | if maintainers.iter().any(|m| { |
| @@ -194,22 +194,13 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 194 | }) { | 194 | }) { |
| 195 | maintainers.join(" ") | 195 | maintainers.join(" ") |
| 196 | } else { | 196 | } else { |
| 197 | [ | 197 | [maintainers, vec![user_ref.public_key.to_bech32()?]] |
| 198 | maintainers, | 198 | .concat() |
| 199 | vec![signer.get_public_key().await?.to_bech32()?], | 199 | .join(" ") |
| 200 | ] | ||
| 201 | .concat() | ||
| 202 | .join(" ") | ||
| 203 | } | 200 | } |
| 204 | }; | 201 | }; |
| 205 | 'outer: loop { | 202 | 'outer: loop { |
| 206 | if !dont_ask | 203 | if !dont_ask && user_ref.public_key.to_bech32()?.eq(&maintainers_string) { |
| 207 | && signer | ||
| 208 | .get_public_key() | ||
| 209 | .await? | ||
| 210 | .to_bech32()? | ||
| 211 | .eq(&maintainers_string) | ||
| 212 | { | ||
| 213 | if Interactor::default().confirm( | 204 | if Interactor::default().confirm( |
| 214 | PromptConfirmParms::default() | 205 | PromptConfirmParms::default() |
| 215 | .with_prompt("are you the only maintainer?") | 206 | .with_prompt("are you the only maintainer?") |
| @@ -259,7 +250,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 259 | } | 250 | } |
| 260 | // add current user incase removed | 251 | // add current user incase removed |
| 261 | if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) { | 252 | if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) { |
| 262 | maintainers.push(signer.get_public_key().await?); | 253 | maintainers.push(user_ref.public_key); |
| 263 | } | 254 | } |
| 264 | break maintainers; | 255 | break maintainers; |
| 265 | } | 256 | } |