upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/git_remote_nostr/main.rs')
-rw-r--r--src/bin/git_remote_nostr/main.rs14
1 files changed, 12 insertions, 2 deletions
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};
28struct PushOptions { 28struct PushOptions {
29 title: Option<String>, 29 title: Option<String>,
30 description: Option<String>, 30 description: Option<String>,
31 git_server_extras: Vec<String>,
31} 32}
32 33
33/// Strip git's c-style quoting from a push-option value. 34/// Strip git's c-style quoting from a push-option value.
@@ -118,6 +119,7 @@ mod list;
118mod push; 119mod push;
119 120
120#[tokio::main] 121#[tokio::main]
122#[allow(clippy::too_many_lines)]
121async fn main() -> Result<()> { 123async fn main() -> Result<()> {
122 if std::env::var("NGITTEST").is_ok() { 124 if std::env::var("NGITTEST").is_ok() {
123 std::env::set_var("NGIT_VERBOSE", "1"); 125 std::env::set_var("NGIT_VERBOSE", "1");
@@ -177,16 +179,23 @@ async fn main() -> Result<()> {
177 } 179 }
178 ["option", "push-option", rest @ ..] => { 180 ["option", "push-option", rest @ ..] => {
179 let option = strip_git_quoting(&rest.join(" ")); 181 let option = strip_git_quoting(&rest.join(" "));
180 if let Some((key, value)) = option.split_once('=') { 182 let handled_by_ngit = if let Some((key, value)) = option.split_once('=') {
181 match key { 183 match key {
182 "title" => { 184 "title" => {
183 push_options.title = Some(decode_push_option_escapes(value)); 185 push_options.title = Some(decode_push_option_escapes(value));
186 true
184 } 187 }
185 "description" => { 188 "description" => {
186 push_options.description = Some(decode_push_option_escapes(value)); 189 push_options.description = Some(decode_push_option_escapes(value));
190 true
187 } 191 }
188 _ => {} 192 _ => false,
189 } 193 }
194 } else {
195 false
196 };
197 if !handled_by_ngit {
198 push_options.git_server_extras.push(option);
190 } 199 }
191 println!("ok"); 200 println!("ok");
192 } 201 }
@@ -206,6 +215,7 @@ async fn main() -> Result<()> {
206 &mut client, 215 &mut client,
207 list_outputs.clone(), 216 list_outputs.clone(),
208 title_description, 217 title_description,
218 push_options.git_server_extras.clone(),
209 ) 219 )
210 .await?; 220 .await?;
211 push_options = PushOptions::default(); 221 push_options = PushOptions::default();