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/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/bin/git_remote_nostr/main.rs') diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index e0821e9..6186ed3 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs @@ -28,6 +28,7 @@ use crate::{client::Client, git::Repo}; struct PushOptions { title: Option, description: Option, + git_server_extras: Vec, } /// Strip git's c-style quoting from a push-option value. @@ -118,6 +119,7 @@ mod list; mod push; #[tokio::main] +#[allow(clippy::too_many_lines)] async fn main() -> Result<()> { if std::env::var("NGITTEST").is_ok() { std::env::set_var("NGIT_VERBOSE", "1"); @@ -177,16 +179,23 @@ async fn main() -> Result<()> { } ["option", "push-option", rest @ ..] => { let option = strip_git_quoting(&rest.join(" ")); - if let Some((key, value)) = option.split_once('=') { + let handled_by_ngit = if let Some((key, value)) = option.split_once('=') { match key { "title" => { push_options.title = Some(decode_push_option_escapes(value)); + true } "description" => { push_options.description = Some(decode_push_option_escapes(value)); + true } - _ => {} + _ => false, } + } else { + false + }; + if !handled_by_ngit { + push_options.git_server_extras.push(option); } println!("ok"); } @@ -206,6 +215,7 @@ async fn main() -> Result<()> { &mut client, list_outputs.clone(), title_description, + push_options.git_server_extras.clone(), ) .await?; push_options = PushOptions::default(); -- cgit v1.2.3