Skip to content

Conversation

rpelliard
Copy link
Contributor

@rpelliard rpelliard commented Oct 6, 2025

This PR adds two simple bindings to interact with the ODB cache:

  • GIT_OPT_SET_CACHE_MAX_SIZE to update the cache max size
  • GIT_OPT_GET_CACHED_MEMORY to retrieve current and max cache size

See relevant libgit2 docs here.

@rpelliard rpelliard marked this pull request as ready for review October 6, 2025 05:21
@rustbot rustbot added the S-waiting-on-review Status: Waiting on review label Oct 6, 2025
src/opts.rs Outdated
/// # Safety
/// This function is modifying a C global without synchronization, so it is not
/// thread safe, and should only be called before any thread is spawned.
pub unsafe fn set_cache_max_size(size: libc::size_t) -> Result<(), Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't all of these values be ssize_t (two s's)?

Not that it makes a huge difference, and it's not clear why it is signed, but probably best to match upstream, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally, I missed this ! Thanks for catching

@ehuss
Copy link
Contributor

ehuss commented Oct 6, 2025

Can you also add a test for this?

@rpelliard rpelliard requested a review from ehuss October 6, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Waiting on review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants