upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/sync.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-09-12 09:01:01 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-09-12 09:01:01 +0100
commit5fd28d490b2b5627f2bdb8e1318c70de4469eb13 (patch)
tree1240f5cea864eb2ae783ba28ae30a98dbf61bf60 /src/bin/ngit/sub_commands/sync.rs
parentf41e51e5840f1cc66fdec1eb4ac2ecf208c67911 (diff)
fix(sync): dont fetch tags available locally
as it was only checking if tip is a commit thats present but a tip could be an annotated tag
Diffstat (limited to 'src/bin/ngit/sub_commands/sync.rs')
-rw-r--r--src/bin/ngit/sub_commands/sync.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bin/ngit/sub_commands/sync.rs b/src/bin/ngit/sub_commands/sync.rs
index 1a2d4ee..0860cc4 100644
--- a/src/bin/ngit/sub_commands/sync.rs
+++ b/src/bin/ngit/sub_commands/sync.rs
@@ -2,6 +2,7 @@ use std::collections::HashMap;
2 2
3use anyhow::{Context, Result, bail}; 3use anyhow::{Context, Result, bail};
4use console::Term; 4use console::Term;
5use git2::Oid;
5use ngit::{ 6use ngit::{
6 client::{ 7 client::{
7 Client, Connect, Params, fetching_with_report, get_repo_ref_from_cache, 8 Client, Connect, Params, fetching_with_report, get_repo_ref_from_cache,
@@ -239,7 +240,14 @@ fn identify_missing_refs(git_repo: &Repo, state: &HashMap<String, String>) -> Ve
239 let mut missing_oids = vec![]; 240 let mut missing_oids = vec![];
240 for tip in state.values() { 241 for tip in state.values() {
241 if let Ok(exist) = git_repo.does_commit_exist(tip) { 242 if let Ok(exist) = git_repo.does_commit_exist(tip) {
242 if !exist { 243 let oid_exists_as_tag = Oid::from_str(tip).is_ok_and(|tip| {
244 git_repo
245 .git_repo
246 .find_object(tip, Some(git2::ObjectType::Tag))
247 .is_ok()
248 });
249
250 if !exist && !oid_exists_as_tag {
243 missing_oids.push(tip.to_string()); 251 missing_oids.push(tip.to_string());
244 } 252 }
245 } 253 }