]> git.99rst.org Git - git.git/commit
commit-reach: reject cycles in contains walk
authorTamir Duberstein <redacted>
Fri, 12 Jun 2026 21:49:12 +0000 (17:49 -0400)
committerJunio C Hamano <redacted>
Fri, 12 Jun 2026 22:56:44 +0000 (15:56 -0700)
commit5bd39784cda151203aa6d97e24c21bf7fddc11de
treed97c78c4964a07b0aae715a83d78b45c1f5a5aea
parent600fe743028cbfb640855f659e9851522214bc0b
commit-reach: reject cycles in contains walk

The memoized contains traversal used by git tag assumes that commit
ancestry is acyclic. Replacement refs can violate that assumption,
causing it to keep pushing an already active commit until memory is
exhausted.

Mark commits while they are active and die if the traversal encounters
an active commit. Other failures in this walk already die through
parse_commit_or_die(); using a second reachability walk would only add
a separate policy for malformed history.

Suggested-by: Kristofer Karlsson <redacted>
Signed-off-by: Tamir Duberstein <redacted>
Signed-off-by: Junio C Hamano <redacted>
commit-reach.c
commit-reach.h
t/t7004-tag.sh
git clone https://git.99rst.org/PROJECT