[PATCH 00/15] name-rev: eliminate recursion
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Sep 19, 2019, 21:46 UTC
- Message-ID
- <20190919214712.7348-1-szeder.dev@gmail.com>
'git name-rev' is implemented using a recursive algorithm, and, consequently, it can segfault in deep histories (e.g. WebKit), and thanks to a test case demonstrating this limitation every test run results in a dmesg entry logging the segfaulting git process.
This patch series eliminates the recursion.
Patches 1-5 and 14-15 are while-at-it cleanups I noticed on the way, and patch 6 improves test coverage.
Patches 7-11 are preparatory refactorings that are supposed to make this series easier to follow, and make patch 12, the one finally eliminating the recursion, somewhat shorter, and even much shorter when viewed with '--ignore-all-space'. Patch 13 cleans up after those preparatory steps.
SZEDER Gábor (15):
t6120-describe: correct test repo history graph in comment
t6120-describe: modernize the 'check_describe' helper
name-rev: use strip_suffix() in get_rev_name()
name-rev: avoid unnecessary cast in name_ref()
name-rev: use sizeof(*ptr) instead of sizeof(type) in allocation
t6120: add a test to cover inner conditions in 'git name-rev's
name_rev()
name-rev: extract creating/updating a 'struct name_rev' into a helper
name-rev: pull out deref handling from the recursion
name-rev: restructure parsing commits and applying date cutoff
name-rev: restructure creating/updating 'struct rev_name' instances
name-rev: drop name_rev()'s 'generation' and 'distance' parameters
name-rev: eliminate recursion in name_rev()
name-rev: cleanup name_ref()
name-rev: plug a memory leak in name_rev()
name-rev: plug a memory leak in name_rev() in the deref casebuiltin/name-rev.c | 140 ++++++++++++++++++++++++++++---------------- t/t6120-describe.sh | 72 ++++++++++++++++++----- 2 files changed, 147 insertions(+), 65 deletions(-)
-- 2.23.0.331.g4e51dcdf11