upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/git_remote_nostr/push.rs14
-rw-r--r--src/bin/ngit/sub_commands/init.rs34
2 files changed, 39 insertions, 9 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index db86c04..8fc8349 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -153,10 +153,18 @@ pub async fn run_push(
153 if !git_server_refspecs.is_empty() { 153 if !git_server_refspecs.is_empty() {
154 let new_state = generate_updated_state(git_repo, &existing_state, &git_server_refspecs)?; 154 let new_state = generate_updated_state(git_repo, &existing_state, &git_server_refspecs)?;
155 155
156 let new_repo_state = 156 let store_state =
157 RepoState::build(repo_ref.identifier.clone(), new_state, &signer).await?; 157 if let Ok(Some(nostate)) = git_repo.get_git_config_item("nostr.nostate", None) {
158 !nostate.eq("true")
159 } else {
160 true
161 };
158 162
159 events.push(new_repo_state.event); 163 if store_state {
164 let new_repo_state =
165 RepoState::build(repo_ref.identifier.clone(), new_state, &signer).await?;
166 events.push(new_repo_state.event);
167 }
160 168
161 for event in get_merged_status_events( 169 for event in get_merged_status_events(
162 &term, 170 &term,
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 05160a8..1d6d0e9 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -252,19 +252,41 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
252 .await? 252 .await?
253 .to_bech32()? 253 .to_bech32()?
254 .eq(&maintainers_string) 254 .eq(&maintainers_string)
255 && Interactor::default().confirm( 255 {
256 if Interactor::default().confirm(
256 PromptConfirmParms::default() 257 PromptConfirmParms::default()
257 .with_prompt("are you the only maintainer?") 258 .with_prompt("are you the only maintainer?")
258 .with_default(true), 259 .with_default(true),
259 )? 260 )? {
260 { 261 dont_ask = true;
261 dont_ask = true; 262 } else {
263 let mut opt_out_default = false;
264 if !Interactor::default().confirm(
265 PromptConfirmParms::default()
266 .with_prompt("are the other maintainers on nostr?")
267 .with_default(true),
268 )? {
269 opt_out_default = true;
270 dont_ask = true;
271 }
272 println!(
273 "nostr can reduce the trust placed in git servers by storing the state of git branches and tags. if you have other maintainers not using git via nostr, the verifiable state can fall behind the git server."
274 );
275
276 if Interactor::default().confirm(
277 PromptConfirmParms::default()
278 .with_prompt("opt-out of storing git state on nostr and relay on git server for now? you will still receive PRs and issues via nostr")
279 .with_default(true),
280 )? {
281 git_repo.save_git_config_item("nostr.nostate", "true", opt_out_default)?;
282 }
283 }
262 } 284 }
263 if !dont_ask { 285 if !dont_ask {
264 println!("{}", &maintainers_string); 286 println!("{}", &maintainers_string);
265 maintainers_string = Interactor::default().input( 287 maintainers_string = Interactor::default().input(
266 PromptInputParms::default() 288 PromptInputParms::default()
267 .with_prompt("maintainers") 289 .with_prompt("maintainers - space seperated list of npubs")
268 .with_default(maintainers_string), 290 .with_default(maintainers_string),
269 )?; 291 )?;
270 } 292 }
@@ -273,7 +295,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
273 if let Ok(m_pubkey) = PublicKey::from_bech32(m) { 295 if let Ok(m_pubkey) = PublicKey::from_bech32(m) {
274 maintainers.push(m_pubkey); 296 maintainers.push(m_pubkey);
275 } else { 297 } else {
276 println!("not a valid set of npubs seperated by a space"); 298 println!("not a valid set of space seperated npubs");
277 dont_ask = false; 299 dont_ask = false;
278 continue 'outer; 300 continue 'outer;
279 } 301 }