From ee4ba36b711002448eb9352e7ac91ccdb190a35f Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 16 Mar 2026 06:21:33 +0700 Subject: [PATCH] Fix patches not updating automatically --- src/cook/fetch.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/cook/fetch.rs b/src/cook/fetch.rs index ead14a44..3d61dfa0 100644 --- a/src/cook/fetch.rs +++ b/src/cook/fetch.rs @@ -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);