From 5c305e922e19e4ac65c6a1473be67145a1c73f2b Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 25 Feb 2026 16:46:02 +0000 Subject: feat: forward unrecognised push options to git servers Any -o option passed to `git push` that is not handled by ngit (title, description) is forwarded verbatim to the git server via git2::PushOptions::remote_push_options. This allows options such as `-o secret-scanning.skip` to pass through transparently. `ngit send` gains a matching -o / --push-option flag for the same purpose. --- src/bin/git_remote_nostr/push.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/bin/git_remote_nostr/push.rs') diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index b64cdd9..06624f4 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -45,6 +45,7 @@ use repo_state::RepoState; use crate::{client::Client, git::Repo}; #[allow(clippy::too_many_lines)] +#[allow(clippy::too_many_arguments)] #[allow(clippy::type_complexity)] pub async fn run_push( git_repo: &Repo, @@ -54,6 +55,7 @@ pub async fn run_push( client: &mut Client, list_outputs: Option, bool)>>, title_description: Option<(String, String)>, + git_server_push_options: Vec, ) -> Result<()> { let refspecs = get_refspecs_from_push_batch(stdin, initial_refspec)?; @@ -132,6 +134,7 @@ pub async fn run_push( existing_state, &term, title_description.as_ref(), + &git_server_push_options, ) .await?; @@ -159,6 +162,8 @@ pub async fn run_push( .cloned() .collect::>(); if !refspecs.is_empty() { + let push_options_refs: Vec<&str> = + git_server_push_options.iter().map(String::as_str).collect(); let _ = push_to_remote( git_repo, &git_server_url, @@ -166,6 +171,7 @@ pub async fn run_push( &remote_refspecs, &term, is_grasp_server_clone_url(&git_server_url), + &push_options_refs, ); } } @@ -187,6 +193,7 @@ async fn create_and_publish_events_and_proposals( existing_state: HashMap, term: &Term, title_description: Option<&(String, String)>, + git_server_push_options: &[String], ) -> Result<(Vec, bool)> { let (signer, mut user_ref, _) = load_existing_login( &Some(git_repo), @@ -281,6 +288,7 @@ async fn create_and_publish_events_and_proposals( &signer, term, title_description, + git_server_push_options, ) .await?; for e in proposal_events { @@ -315,6 +323,7 @@ async fn process_proposal_refspecs( signer: &Arc, term: &Term, title_description: Option<&(String, String)>, + git_server_push_options: &[String], ) -> Result<(Vec, Vec)> { let mut events = vec![]; let mut rejected_proposal_refspecs = vec![]; @@ -357,6 +366,7 @@ async fn process_proposal_refspecs( signer, term, title_description, + git_server_push_options, ) .await? { @@ -398,6 +408,7 @@ async fn process_proposal_refspecs( signer, term, title_description, + git_server_push_options, ) .await? { @@ -469,6 +480,7 @@ async fn process_proposal_refspecs( signer, term, title_description, + git_server_push_options, ) .await? { @@ -492,6 +504,7 @@ async fn generate_patches_or_pr_event_or_pr_updates( signer: &Arc, term: &Term, title_description: Option<&(String, String)>, + git_server_push_options: &[String], ) -> Result> { let parent_is_pr = root_proposal.is_some_and(|proposal| proposal.kind.eq(&KIND_PULL_REQUEST)); let use_pr = parent_is_pr || git_repo.are_commits_too_big_for_patches(ahead); @@ -499,6 +512,8 @@ async fn generate_patches_or_pr_event_or_pr_updates( if use_pr { let tip = ahead.first().context("no commits")?; // ahead is youngest first let first_commit = ahead.last().context("no commits")?; + let push_options_refs: Vec<&str> = + git_server_push_options.iter().map(String::as_str).collect(); select_servers_push_refs_and_generate_pr_or_pr_update_event( client, git_repo, @@ -512,6 +527,7 @@ async fn generate_patches_or_pr_event_or_pr_updates( signer, false, term, + &push_options_refs, ) .await .context(format!( -- cgit v1.2.3