diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 13:41:01 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 15:26:19 +0000 |
| commit | b85683201250e97a30bfe7a5dbba5508f8e86f65 (patch) | |
| tree | 216b8e344d346c8007a1796a33dbcf073a63c9e7 | |
| parent | 0d6ed93e4d143bb066205543af13f0ec6ddbdd58 (diff) | |
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'.
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 481b39c..4e4fdbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
| @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 14 | 14 | ||
| 15 | ### Fixed | 15 | ### Fixed |
| 16 | 16 | ||
| 17 | - Tag tracking refs written with wrong path (`refs/remotes/origin/refs/tags/v1.0.0` instead of `refs/remotes/origin/v1.0.0`) after a push via `git-remote-nostr`, causing `ngit sync` to fail with "src refspec does not match any existing object" when syncing tags | ||
| 17 | - `ngit sync` using wrong refspec source (`refs/remotes/origin/refs/heads/master` instead of `refs/remotes/origin/master`), causing sync to fail with "src refspec does not match any existing object" | 18 | - `ngit sync` using wrong refspec source (`refs/remotes/origin/refs/heads/master` instead of `refs/remotes/origin/master`), causing sync to fail with "src refspec does not match any existing object" |
| 18 | - State event publish failures silently swallowed during push; summary now shows `"Published to X/N relays (failed: relay1 relay2)"` instead of unconditional success message | 19 | - State event publish failures silently swallowed during push; summary now shows `"Published to X/N relays (failed: relay1 relay2)"` instead of unconditional success message |
| 19 | - Grasp servers whose internal relay did not receive the state event are now skipped during push, with a clear warning; push fails with an error message when no servers remain | 20 | - Grasp servers whose internal relay did not receive the state event are now skipped during push, with a clear warning; push fails with an error message when no servers remain |
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( | |||
| 1573 | let nostr_remote = git_repo | 1573 | let nostr_remote = git_repo |
| 1574 | .find_remote(&get_remote_name_by_url(git_repo, nostr_remote_url)?) | 1574 | .find_remote(&get_remote_name_by_url(git_repo, nostr_remote_url)?) |
| 1575 | .context("we should have just located this remote")?; | 1575 | .context("we should have just located this remote")?; |
| 1576 | let short_name = if let Some(s) = to.strip_prefix("refs/heads/") { | ||
| 1577 | s.to_string() | ||
| 1578 | } else if let Some(s) = to.strip_prefix("refs/tags/") { | ||
| 1579 | s.to_string() | ||
| 1580 | } else { | ||
| 1581 | to.to_string() | ||
| 1582 | }; | ||
| 1576 | Ok(format!( | 1583 | Ok(format!( |
| 1577 | "refs/remotes/{}/{}", | 1584 | "refs/remotes/{}/{}", |
| 1578 | nostr_remote.name().context("remote should have a name")?, | 1585 | nostr_remote.name().context("remote should have a name")?, |
| 1579 | to.replace("refs/heads/", ""), /* TODO only replace if it begins with this | 1586 | short_name, |
| 1580 | * TODO what about tags? */ | ||
| 1581 | )) | 1587 | )) |
| 1582 | } | 1588 | } |
| 1583 | 1589 | ||