mirror of
https://github.com/Llewellynvdm/starship.git
synced 2025-01-23 07:08:25 +00:00
fix(git_status): Avoid printing error on missing stash ref (#5434)
* fix(git_status): Avoid printing error on missing stash ref * ensure we only proceed if the returned reference has the expected name
This commit is contained in:
parent
e79014a99f
commit
00d3dc86a2
@ -256,11 +256,12 @@ fn get_repo_status(
|
|||||||
fn get_stashed_count(repo: &context::Repo) -> Option<usize> {
|
fn get_stashed_count(repo: &context::Repo) -> Option<usize> {
|
||||||
let repo = repo.open();
|
let repo = repo.open();
|
||||||
let reference = match repo.try_find_reference("refs/stash") {
|
let reference = match repo.try_find_reference("refs/stash") {
|
||||||
Ok(Some(reference)) => reference,
|
// Only proceed if the found reference has the expected name (not tags/refs/stash etc.)
|
||||||
|
Ok(Some(reference)) if reference.name().as_bstr() == b"refs/stash".as_slice() => reference,
|
||||||
// No stash reference found
|
// No stash reference found
|
||||||
Ok(None) => return Some(0),
|
Ok(_) => return Some(0),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("Error finding stash reference: {err}");
|
log::debug!("Error finding stash reference: {err}");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -272,7 +273,7 @@ fn get_stashed_count(repo: &context::Repo) -> Option<usize> {
|
|||||||
Some(0)
|
Some(0)
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("Error getting stash log: {err}");
|
log::debug!("Error getting stash log: {err}");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user