upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-13 21:41:30 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-13 22:11:18 +0000
commit51fee1f4c90924e59aaf23f0d52a848816f61b1f (patch)
tree1020e41d6545bd5423954dbc443e7c5dd1e8e228
parentcfa26fa55b72783ea64bbd39d5d0fbdf94370b1b (diff)
fix: don't attempt to fetch annotated tags we have
because thats not needed
-rw-r--r--src/lib/fetch.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/fetch.rs b/src/lib/fetch.rs
index eeed8f4..830c129 100644
--- a/src/lib/fetch.rs
+++ b/src/lib/fetch.rs
@@ -27,10 +27,23 @@ pub fn fetch_from_git_server(
27 term: &console::Term, 27 term: &console::Term,
28 is_grasp_server: bool, 28 is_grasp_server: bool,
29) -> Result<()> { 29) -> Result<()> {
30 let already_have_oids = oids 30 // Check which OIDs are missing, invalid, or annotated tags
31 .iter() 31 let mut missing_oids: Vec<&String> = Vec::new();
32 .all(|oid| git_repo.does_commit_exist(oid).is_ok_and(|outcome| outcome)); 32
33 if already_have_oids { 33 for oid in oids {
34 // First check if it's a valid OID format
35 if let Ok(oid_obj) = git2::Oid::from_str(oid) {
36 // Skip annotated tags (they point to tag objects, not commits)
37 if git_repo.git_repo.find_tag(oid_obj).is_err() {
38 // Check if commit exists
39 if let Ok(false) = git_repo.does_commit_exist(oid) {
40 missing_oids.push(oid)
41 }
42 }
43 }
44 }
45
46 if missing_oids.is_empty() {
34 return Ok(()); 47 return Ok(());
35 } 48 }
36 49