mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
fix: use git2-based LogWalker on OHOS to avoid gix InsufficientSlots panic
On OpenHarmony, gix-odb fails with InsufficientSlots
{ current: 32, needed: 4 } when loading pack indices
during commit log walking. This happens because
LogWalkerWithoutFilter uses gix which has a limited
slot map for managing ODB index files.
Fall back to git2-based LogWalker on OHOS targets,
which can handle both filtered and unfiltered log
walking without this issue.
This commit is contained in:
parent
5b1e7565b3
commit
621ff5b4bf
1 changed files with 43 additions and 21 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Result,
|
error::Result,
|
||||||
sync::{
|
sync::{
|
||||||
gix_repo, repo, CommitId, LogWalker, LogWalkerWithoutFilter,
|
repo, CommitId, LogWalker, RepoPath, SharedCommitFilterFn,
|
||||||
RepoPath, SharedCommitFilterFn,
|
|
||||||
},
|
},
|
||||||
AsyncGitNotification, Error,
|
AsyncGitNotification, Error,
|
||||||
};
|
};
|
||||||
|
#[cfg(not(target_env = "ohos"))]
|
||||||
|
use crate::sync::{gix_repo, LogWalkerWithoutFilter};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use scopetime::scope_time;
|
use scopetime::scope_time;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
@ -200,25 +201,45 @@ impl AsyncLog {
|
||||||
sender: &Sender<AsyncGitNotification>,
|
sender: &Sender<AsyncGitNotification>,
|
||||||
filter: Option<SharedCommitFilterFn>,
|
filter: Option<SharedCommitFilterFn>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
filter.map_or_else(
|
#[cfg(target_env = "ohos")]
|
||||||
|| {
|
{
|
||||||
Self::fetch_helper_without_filter(
|
Self::fetch_helper_with_filter(
|
||||||
repo_path,
|
repo_path,
|
||||||
arc_current,
|
arc_current,
|
||||||
arc_background,
|
arc_background,
|
||||||
sender,
|
sender,
|
||||||
)
|
filter.unwrap_or_else(|| {
|
||||||
},
|
Arc::new(Box::new(
|
||||||
|filter| {
|
|_: &git2::Repository, _: &CommitId| {
|
||||||
Self::fetch_helper_with_filter(
|
Ok(true)
|
||||||
repo_path,
|
},
|
||||||
arc_current,
|
))
|
||||||
arc_background,
|
}),
|
||||||
sender,
|
)
|
||||||
filter,
|
}
|
||||||
)
|
|
||||||
},
|
#[cfg(not(target_env = "ohos"))]
|
||||||
)
|
{
|
||||||
|
filter.map_or_else(
|
||||||
|
|| {
|
||||||
|
Self::fetch_helper_without_filter(
|
||||||
|
repo_path,
|
||||||
|
arc_current,
|
||||||
|
arc_background,
|
||||||
|
sender,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|filter| {
|
||||||
|
Self::fetch_helper_with_filter(
|
||||||
|
repo_path,
|
||||||
|
arc_current,
|
||||||
|
arc_background,
|
||||||
|
sender,
|
||||||
|
filter,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fetch_helper_with_filter(
|
fn fetch_helper_with_filter(
|
||||||
|
|
@ -265,6 +286,7 @@ impl AsyncLog {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_env = "ohos"))]
|
||||||
fn fetch_helper_without_filter(
|
fn fetch_helper_without_filter(
|
||||||
repo_path: &RepoPath,
|
repo_path: &RepoPath,
|
||||||
arc_current: &Arc<Mutex<AsyncLogResult>>,
|
arc_current: &Arc<Mutex<AsyncLogResult>>,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue