From 4ec76fb35602fa8d44b050a10f68dec79f25e2f6 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Sat, 28 Feb 2026 11:14:30 -0500 Subject: simplified updating process --- src/util.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/util.rs') diff --git a/src/util.rs b/src/util.rs index 7bd2142..9d44e70 100644 --- a/src/util.rs +++ b/src/util.rs @@ -110,7 +110,7 @@ pub fn print_collected_packages(packages: &PackageList, message: &str) { ); } -pub fn pull_repo(path: &Path) -> Result<(), git2::Error> { +pub fn pull_repo(path: &Path) -> Result { let repo = Repository::open(path)?; let head = repo.head()?; @@ -135,20 +135,18 @@ pub fn pull_repo(path: &Path) -> Result<(), git2::Error> { let (analysis, _pref) = repo.merge_analysis(&[&fetch_commit])?; if analysis.is_fast_forward() { - println!("Fast-forwarding..."); - let refname = format!("refs/heads/{}", branch); let mut reference = repo.find_reference(&refname)?; reference.set_target(fetch_commit.id(), "Fast-Forward")?; repo.set_head(&refname)?; repo.checkout_head(Some(CheckoutBuilder::default().force()))?; + Ok(true) } else if analysis.is_up_to_date() { - println!("Already up to date."); + Ok(false) } else { println!("Non fast-forward merge required (manual merge needed)."); + Ok(false) } - - Ok(()) } pub fn yn_prompt(prompt: &str) -> bool { -- cgit v1.2.3-59-g8ed1b