From b85683201250e97a30bfe7a5dbba5508f8e86f65 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 26 Feb 2026 13:41:01 +0000 Subject: fix: strip refs/tags/ prefix when computing remote tracking ref name refspec_remote_ref_name() only stripped refs/heads/, so tag refspecs produced refs/remotes/origin/refs/tags/v1.0.0 instead of refs/remotes/origin/v1.0.0. ngit sync reads the latter form, so the tracking ref was never found and sync failed with 'src refspec does not match any existing object'. --- src/bin/git_remote_nostr/push.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 e5c33b6..b0e7726 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -1573,11 +1573,17 @@ fn refspec_remote_ref_name( let nostr_remote = git_repo .find_remote(&get_remote_name_by_url(git_repo, nostr_remote_url)?) .context("we should have just located this remote")?; + let short_name = if let Some(s) = to.strip_prefix("refs/heads/") { + s.to_string() + } else if let Some(s) = to.strip_prefix("refs/tags/") { + s.to_string() + } else { + to.to_string() + }; Ok(format!( "refs/remotes/{}/{}", nostr_remote.name().context("remote should have a name")?, - to.replace("refs/heads/", ""), /* TODO only replace if it begins with this - * TODO what about tags? */ + short_name, )) } -- cgit v1.2.3