1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-12-01 21:23:20 +03:00
git-cliff/git-cliff-core
Amin Yahyaabadi 8430c5c539
perf(changelog): cache commit retain checks (258 times faster generation) (#772)
* perf: cache commit retain checks + 87 times faster generation

This caches the commit retain checks whenever include/exclude paths are specified.

This speeds up changelog generation by `87` times in a big repository I have:
```
Now: 0.237 s
Before:  20.633 s
```

* perf: use separate retain_commit cache for each repository

* fix: use cacache for parallel git-local cache - 258 times faster

Sled fails to open the cache if multiple git-cliff processes run on the same repository. This fixes the issue by using cacache which stores the cache locally under .git/git-cliff

* fix: cache changed files of a commit directly

This slows down the retain_commit check by ~2 times, but allows reusing the cache in case the include/exclude patterns change.
This is beneficial for running in monorepos where git-cliff runs multiple times to generate changelog for different subsets of the repo

* fix: consider include/exclude patterns together

* fix: handle first commit for changed_files

* fix: normalize glob patterns to ignore ./

* docs: add docs for retain_commit_check and cache algorithms

* fix: add ** if a pattern represents a directory

* test: add tests for should retain commit checks

* fix: correctly get the files list for the first commit

* test: add test email/name for git commits

* fix: use / for path joining in entries to match the git behaviour

* fix: revert change of include/exclude patterns to slices

The slices are normalized, so an owned pattern is needed to avoid type mismatch between new normalized/unchanged patterns

* refactor: polish implementation

* refactor: apply clippy suggestion

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2024-08-06 23:04:17 +03:00
..
src perf(changelog): cache commit retain checks (258 times faster generation) (#772) 2024-08-06 23:04:17 +03:00
tests feat(context): add repository path to template context (#721) 2024-06-25 23:41:37 +03:00
Cargo.toml perf(changelog): cache commit retain checks (258 times faster generation) (#772) 2024-08-06 23:04:17 +03:00