mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 23:44:17 +08:00
Fix changing git rev cache
This commit is contained in:
parent
a4be504b40
commit
0f7323e47a
@ -238,14 +238,18 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
|
||||
run_command(command, logger)?;
|
||||
|
||||
let (head_rev, detached_rev) = get_git_head_rev(&source_dir)?;
|
||||
if detached_rev {
|
||||
if let Some(rev) = rev
|
||||
if rev.is_some() {
|
||||
if !detached_rev {
|
||||
false
|
||||
} else if let Some(rev) = rev
|
||||
&& let Ok(exp_rev) = get_git_tag_rev(&source_dir, &rev)
|
||||
{
|
||||
exp_rev == head_rev
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else if detached_rev {
|
||||
false
|
||||
} else {
|
||||
let (_, remote_branch, remote_name, remote_url) =
|
||||
get_git_remote_tracking(&source_dir)?;
|
||||
|
||||
@ -298,6 +298,7 @@ pub fn get_git_tag_rev(dir: &PathBuf, tag: &str) -> Result<String> {
|
||||
}
|
||||
|
||||
pub fn get_git_ref_entry(dir: &PathBuf, entry: &str) -> Result<String> {
|
||||
// https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
|
||||
let git_refs = dir.join(".git/packed-refs");
|
||||
let refs_str = read_to_string(&git_refs)?;
|
||||
for line in refs_str.lines() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user