⛏️ index : gitore.git

author Alexander von Gluck IV <alex@terarocket.io> 2026-01-02 14:27:28.0 -06:00:00
committer Alexander von Gluck IV <alex@terarocket.io> 2026-01-02 14:27:28.0 -06:00:00
commit
712150d7b33af2ba6ac471476487cab7b791672e [patch]
tree
68907b0d377d44ec3b6228718d97db6d1adc78ac
parent
a174040bea64f570e89de81e7308a22f6b7263cf
download
712150d7b33af2ba6ac471476487cab7b791672e.tar.gz

git/indexer: Start with more gitoxide slot space; reduce #22



Diff

 src/database/indexer.rs | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/database/indexer.rs b/src/database/indexer.rs
index 0804c8a..d83ad3b 100644
--- a/src/database/indexer.rs
+++ b/src/database/indexer.rs
@@ -39,6 +39,10 @@

    info!("Starting index update");

	// TODO: Somewhere in here, we need to check repo.objects.store_ref().metrics().unused_slots
	// for each repository, and close / reopen the repo with gixoxide to avoid running out of available
	// slots. See codeberg.org/kallisti5/gitore/issues/22.

    update_repository_metadata(scan_path, repository_list, db);
    update_repository_reflog(scan_path, db.clone());
    update_repository_tags(scan_path, db.clone());
@@ -602,6 +606,19 @@

fn get_relative_path<'a>(relative_to: &Path, full_path: &'a Path) -> Option<&'a Path> {
    full_path.strip_prefix(relative_to).ok()
}

/// Helps reduce the frequency of repo reopens to enlarge slots in gitoxide

/// see https://github.com/GitoxideLabs/gitoxide/issues/1788

fn gix_open_options() -> gix::open::Options {
	gix::open::Options::default()
		.object_store_slots(
			gix::odb::store::init::Slots::AsNeededByDiskState {
				multiplier: 1.5,
				minimum: 512,
			}
		)
		.open_path_as_is(true)
}

fn discover_repositories(
@@ -651,7 +668,7 @@
    };

    for dir in dirs {
        match gix::open_opts(&dir, gix::open::Options::default().open_path_as_is(true)) {
        match gix::open_opts(&dir, gix_open_options()) {
            Ok(mut repo) => {
                repo.object_cache_size(10 * 1024 * 1024);
                discovered_repos.push((dir, repo));