diff options
| -rw-r--r-- | src/lib/fetch.rs | 21 |
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 | ||