diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-09-12 09:01:01 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-09-12 09:01:01 +0100 |
| commit | 5fd28d490b2b5627f2bdb8e1318c70de4469eb13 (patch) | |
| tree | 1240f5cea864eb2ae783ba28ae30a98dbf61bf60 /src/bin/ngit/sub_commands/init.rs | |
| parent | f41e51e5840f1cc66fdec1eb4ac2ecf208c67911 (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/init.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 11a812b..385eeca 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -9,6 +9,7 @@ use std::{ | |||
| 9 | 9 | ||
| 10 | use anyhow::{Context, Result, bail}; | 10 | use anyhow::{Context, Result, bail}; |
| 11 | use console::{Style, Term}; | 11 | use console::{Style, Term}; |
| 12 | use git2::Oid; | ||
| 12 | use ngit::{ | 13 | use ngit::{ |
| 13 | UrlWithoutSlash, | 14 | UrlWithoutSlash, |
| 14 | cli_interactor::{ | 15 | cli_interactor::{ |
| @@ -794,7 +795,13 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 794 | let mut required_oids = vec![]; | 795 | let mut required_oids = vec![]; |
| 795 | for tip in origin_state.values() { | 796 | for tip in origin_state.values() { |
| 796 | if let Ok(exist) = git_repo.does_commit_exist(tip) { | 797 | if let Ok(exist) = git_repo.does_commit_exist(tip) { |
| 797 | if !exist { | 798 | let oid_exists_as_tag = Oid::from_str(tip).is_ok_and(|tip| { |
| 799 | git_repo | ||
| 800 | .git_repo | ||
| 801 | .find_object(tip, Some(git2::ObjectType::Tag)) | ||
| 802 | .is_ok() | ||
| 803 | }); | ||
| 804 | if !exist && !oid_exists_as_tag { | ||
| 798 | required_oids.push(tip.clone()); | 805 | required_oids.push(tip.clone()); |
| 799 | } | 806 | } |
| 800 | } | 807 | } |