From 9386cc2e409cc4117ae1792411179a9cd986b3f3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 19 Jun 2025 09:30:16 +0100 Subject: refactor: move build state function in preparation for enforcing the inclusion of HEAD --- src/bin/git_remote_nostr/push.rs | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (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 56bf177..434dae9 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -8,9 +8,7 @@ use std::{ use anyhow::{Context, Result, anyhow, bail}; use auth_git2::GitAuthenticator; -use client::{ - STATE_KIND, get_events_from_local_cache, get_state_from_cache, send_events, sign_event, -}; +use client::{get_events_from_local_cache, get_state_from_cache, send_events, sign_event}; use console::Term; use git::{RepoActions, sha1_to_oid}; use git_events::{ @@ -1549,39 +1547,6 @@ fn get_refspecs_from_push_batch(stdin: &Stdin, initial_refspec: &str) -> Result< Ok(refspecs) } -trait BuildRepoState { - async fn build( - identifier: String, - state: HashMap, - signer: &Arc, - ) -> Result; -} -impl BuildRepoState for RepoState { - async fn build( - identifier: String, - state: HashMap, - signer: &Arc, - ) -> Result { - let mut tags = vec![Tag::identifier(identifier.clone())]; - for (name, value) in &state { - tags.push(Tag::custom(nostr_sdk::TagKind::Custom(name.into()), vec![ - value.clone(), - ])); - } - let event = sign_event( - EventBuilder::new(STATE_KIND, "").tags(tags), - signer, - "git state".to_string(), - ) - .await?; - Ok(RepoState { - identifier, - state, - event, - }) - } -} - #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3