Fix patches not updating automatically

This commit is contained in:
Wildan M 2026-03-16 06:21:33 +07:00
parent 139ccd9655
commit ee4ba36b71
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79

View File

@ -261,6 +261,14 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
// git fetch upstream
}
if !patches.is_empty() || script.is_some() {
// Hard reset
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("reset").arg("--hard");
run_command(command, logger)?;
}
if let Some(rev) = rev {
// Check out specified revision
let mut command = Command::new("git");
@ -268,13 +276,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
command.arg("checkout").arg(rev);
run_command(command, logger)?;
} else if !is_redox() {
//If patches exists, we have to drop it
if patches.len() > 0 {
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("reset").arg("--hard");
run_command(command, logger)?;
}
//TODO: complicated stuff to check and reset branch to origin
//TODO: redox can't undestand this (got exit status 1)
let mut command = Command::new("bash");
@ -286,14 +287,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
run_command(command, logger)?;
}
if !patches.is_empty() || script.is_some() {
// Hard reset
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("reset").arg("--hard");
run_command(command, logger)?;
}
// Sync submodules URL
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);