Check pinned rev to fix reload on TUI

This commit is contained in:
Wildan M 2026-05-09 20:34:52 +07:00
parent b356334d14
commit 35288e173d
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
2 changed files with 9 additions and 1 deletions

View File

@ -717,7 +717,7 @@ fn parse_args(args: Vec<String>) -> Result<(CliConfig, CliCommand, Vec<CookRecip
.flatten()
{
if let Some(SourceRecipe::Git { rev, branch, .. }) = &mut recipe.recipe.source {
*rev = Some(gitrev);
*rev = Some(gitrev.clone());
*branch = None;
} else {
println!(
@ -725,6 +725,7 @@ fn parse_args(args: Vec<String>) -> Result<(CliConfig, CliCommand, Vec<CookRecip
recipe.name.as_str()
);
}
recipe.pinned = true;
}
}
}

View File

@ -187,6 +187,8 @@ pub struct CookRecipe {
/// If false, it's listed on install config
pub is_deps: bool,
pub rule: String,
/// whether if this recipe is pinned from cookbook.lock
pub pinned: bool,
}
impl Recipe {
@ -244,6 +246,7 @@ impl CookRecipe {
target,
is_deps: false,
rule: "".into(),
pinned: false,
})
}
@ -426,6 +429,10 @@ impl CookRecipe {
}
pub fn reload_recipe(&mut self) -> Result<(), PackageError> {
if self.pinned {
// TODO: print?
return Ok(());
}
self.recipe = Self::from_path(&self.dir, true, self.name.is_host())?.recipe;
let _ = self.apply_filesystem_config(&self.rule.clone());
Ok(())