diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-30 09:54:15 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-30 09:54:15 +0100 |
| commit | b1eabeb315dba8860f34c92e0e362559d3352ef7 (patch) | |
| tree | 236854d688c6ab62e9bf2efc810e823f22a18b99 /src/bin/git_remote_nostr | |
| parent | c846a20d653ebaa547eba2ab52a19c311341bd7d (diff) | |
fix(remote): support lightweight tags
I have now replicated the issue discussed in the last commit by
overwriting my global git config item tag.gpgSign and setting
it back to false, which is default the default.
ngit was only supporting annotated tags and fiatjaf was pushing
a lightweight tag.
I'm confident that this will resolve the issue
Diffstat (limited to 'src/bin/git_remote_nostr')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 9cf6dff..73d76b4 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -790,26 +790,37 @@ fn generate_updated_state( | |||
| 790 | new_state.remove(&format!("{to}{}", "^{}")); | 790 | new_state.remove(&format!("{to}{}", "^{}")); |
| 791 | } | 791 | } |
| 792 | } else if to.contains("refs/tags") { | 792 | } else if to.contains("refs/tags") { |
| 793 | new_state.insert( | 793 | if let Ok(annotated_tag) = git_repo |
| 794 | format!("{to}{}", "^{}"), | 794 | .git_repo |
| 795 | git_repo | 795 | .find_reference(from) |
| 796 | .get_commit_or_tip_of_reference(from) | 796 | .context(format!("cannot find ref {from} to push to {to}"))? |
| 797 | .context(format!( | 797 | .peel(git2::ObjectType::Tag) |
| 798 | "cannot find commit from ref {from} to push to {to}" | 798 | { |
| 799 | ))? | 799 | // this is an anotated tag so there is a tag oid |
| 800 | .to_string(), | 800 | // ref points to tag oid |
| 801 | ); | 801 | new_state.insert(to.to_string(), annotated_tag.id().to_string()); |
| 802 | new_state.insert( | 802 | // dereferenced tags ref points to commit at its head |
| 803 | to.to_string(), | 803 | new_state.insert( |
| 804 | git_repo | 804 | format!("{to}{}", "^{}"), |
| 805 | .git_repo | 805 | git_repo |
| 806 | .find_reference(from) | 806 | .get_commit_or_tip_of_reference(from) |
| 807 | .context(format!("cannot find ref {from} to push to {to}"))? | 807 | .context(format!( |
| 808 | .peel(git2::ObjectType::Tag) | 808 | "cannot find commit from annotated tag ref {from} to push to {to}" |
| 809 | .context(format!("cannot find tag id {from} to push to {to}"))? | 809 | ))? |
| 810 | .id() | 810 | .to_string(), |
| 811 | .to_string(), | 811 | ); |
| 812 | ); | 812 | } else { |
| 813 | // this is a lightweight tag so there is no tag oid | ||
| 814 | new_state.insert( | ||
| 815 | to.to_string(), | ||
| 816 | git_repo | ||
| 817 | .get_commit_or_tip_of_reference(from) | ||
| 818 | .context(format!( | ||
| 819 | "cannot find commit from annotated tag ref {from} to push to {to}" | ||
| 820 | ))? | ||
| 821 | .to_string(), | ||
| 822 | ); | ||
| 823 | } | ||
| 813 | } else { | 824 | } else { |
| 814 | // add or update | 825 | // add or update |
| 815 | new_state.insert( | 826 | new_state.insert( |