From 63eab42035078bc078ab86a575fcdd65b52f435e Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 18 Aug 2025 12:23:56 +0100 Subject: fix(sync): include all valid nostr state we weren't correctly identifying valid nostr state refs --- src/bin/ngit/sub_commands/sync.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bin/ngit/sub_commands/sync.rs b/src/bin/ngit/sub_commands/sync.rs index 61c13a8..5578a0f 100644 --- a/src/bin/ngit/sub_commands/sync.rs +++ b/src/bin/ngit/sub_commands/sync.rs @@ -116,10 +116,7 @@ pub async fn launch(args: &SubCommandArgs) -> Result<()> { continue; } } - if nostr_ref_name.starts_with("refs/heads/") - || nostr_ref_name.starts_with("refs/tags/") - || !nostr_ref_name.starts_with("refs/heads/pr/") - { + if invalid_nostr_state_ref(nostr_ref_name) { // ensure nostr_state only supports refs/heads and refs/tags/ // and not refs/heads/prs/* } else if let Some(remote_ref_value) = remote_state.get(nostr_ref_name) { @@ -214,3 +211,8 @@ pub async fn launch(args: &SubCommandArgs) -> Result<()> { Ok(()) } + +fn invalid_nostr_state_ref(ref_name: &str) -> bool { + ref_name.starts_with("refs/heads/pr/") + && !(ref_name.starts_with("refs/heads/") || ref_name.starts_with("refs/tags/")) +} -- cgit v1.2.3