Skip to main content

build_history_index_cached

Function build_history_index_cached 

Source
pub fn build_history_index_cached(
    root: &Path,
    options: &Options,
    config: &CacheConfig,
) -> Result<HistoryIndex, Error>
Available on crate feature vcs-git only.
Expand description

Like build_history_index, but reuse and update the persistent change-history cache per config (issue #334).

On an unchanged tree this replays a cached event log instead of re-walking; when HEAD has advanced it walks only the new commits and splices them onto the cached tail. The result is bit-identical to an uncached build_history_index at the same reference time — the cache is a pure optimization. A missing or corrupt entry is silently recomputed; an entry is ignored when the schema, score, or option fingerprint differs (window changes force a fresh walk). With CacheConfig::enabled false this degrades to a plain walk (still honouring CacheConfig::clear).

§Errors

The same variants as build_history_index, plus Error::Cache when --clear-cache is requested but the cache directory cannot be removed. A failure to write a fresh entry is logged, not returned.