aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.rs
diff options
context:
space:
mode:
authorGravatar BanceDev 2026-02-28 11:14:30 -0500
committerGravatar BanceDev 2026-02-28 11:14:30 -0500
commit4ec76fb35602fa8d44b050a10f68dec79f25e2f6 (patch)
treedbabcd44b06562733a5768b01f2e7a75649e57d0 /src/util.rs
parentactually trigger the post-hooks (diff)
simplified updating process
Diffstat (limited to '')
-rw-r--r--src/util.rs10
1 files changed, 4 insertions, 6 deletions
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<bool, git2::Error> {
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 {