Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
ystyle committed May 21, 2026
commit 621ff5b4bfc392eaa2dfeff83e9e14fb3dd15cad
64 changes: 43 additions & 21 deletions asyncgit/src/revlog.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::{
error::Result,
sync::{
gix_repo, repo, CommitId, LogWalker, LogWalkerWithoutFilter,
RepoPath, SharedCommitFilterFn,
repo, CommitId, LogWalker, RepoPath, SharedCommitFilterFn,
},
AsyncGitNotification, Error,
};
#[cfg(not(target_env = "ohos"))]
use crate::sync::{gix_repo, LogWalkerWithoutFilter};
use crossbeam_channel::Sender;
use scopetime::scope_time;
use std::{
Expand Down Expand Up @@ -200,25 +201,45 @@ impl AsyncLog {
sender: &Sender<AsyncGitNotification>,
filter: Option<SharedCommitFilterFn>,
) -> Result<()> {
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,
)
},
)
#[cfg(target_env = "ohos")]
{
Self::fetch_helper_with_filter(
repo_path,
arc_current,
arc_background,
sender,
filter.unwrap_or_else(|| {
Arc::new(Box::new(
|_: &git2::Repository, _: &CommitId| {
Ok(true)
},
))
}),
)
}

#[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(
Expand Down Expand Up @@ -265,6 +286,7 @@ impl AsyncLog {
Ok(())
}

#[cfg(not(target_env = "ohos"))]
fn fetch_helper_without_filter(
repo_path: &RepoPath,
arc_current: &Arc<Mutex<AsyncLogResult>>,
Expand Down