[PATCH v3 0/3] Reuse --contains traversal results
- From
Tamir Duberstein <tamird@gmail.com>
- Date
- Jun 12, 2026, 03:00 UTC
- Message-ID
- <20260611-ref-filter-memoized-contains-v3-0-b26af3dba285@gmail.com>
- In-Reply-To
- <20260608-ref-filter-memoized-contains-v2-0-e72720344a7c@gmail.com>
git tag uses a memoized traversal for --contains, while git branch and git for-each-ref repeat a reachability walk for each ref. Reuse the memoized traversal when generation numbers can bound the walk.
The first patch makes the memoized traversal handle replacement cycles. The last makes the non-memoized path report reachability errors.
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
--- Changes in v3: - Split missing-ancestor error handling into its own patch. - Use die() for reachability errors, remove redundant cache setup, and chain cycle-test cleanup. - Drop the unrelated empty-target-list behavior change. - Explain why git tag retains memoization without generation numbers. - Add p1500 coverage for all three frontends and a shared-history case. - Remove correctness checks from p1500 and drop output hashes. - Link to v2: https://patch.msgid.link/20260608-ref-filter-memoized-contains-v2-0-e72720344a7c@gmail.com
Changes in v2: - Split cycle handling into a preparatory patch. - Exercise cycle handling through the existing git tag path. - Move perf result verification out of setup. - Link to v1: https://patch.msgid.link/20260607-ref-filter-memoized-contains-v1-1-a1972dde9c76@gmail.com
---
Tamir Duberstein (3):
commit-reach: handle cycles in contains walk
ref-filter: memoize --contains with generations
commit-reach: die on contains walk errorscommit-reach.c | 40 ++++++++++++++++++++++++++++++++++------ commit-reach.h | 3 ++- t/perf/p1500-graph-walks.sh | 28 +++++++++++++++++++++++++++- t/t6301-for-each-ref-errors.sh | 22 ++++++++++++++++++++++ t/t7004-tag.sh | 21 +++++++++++++++++++++ 5 files changed, 106 insertions(+), 8 deletions(-) --- base-commit: 9ac3f193c05c2237e2b14ebaa1149e9fc8a1abe0 change-id: 20260607-ref-filter-memoized-contains-7cb6b3bccad1
Best regards, -- Tamir Duberstein <tamird@gmail.com>