Splitting off from: https://public-inbox.org/git/cover-0.2-0000000000-20210607T144206Z-avarab@xxxxxxxxx/T/#me5d3176914d4268fd9f2a96fc63f4e41beb26bd6 On Tue, Jun 08, 2021 at 06:14:42PM +0200, René Scharfe wrote: > I wonder (only in a semi-curious way, though) if we can detect > off-by-one errors by adding an assertion to display_progress() that > requires the first update to have the value 0, and in stop_progress() > one that requires the previous display_progress() call to have a value > equal to the total number of work items. Not sure it'd be worth the > hassle.. I fixed and reported a number of bogus progress lines in the past, the last one during v2.31.0-rc phase, so I've looked into whether progress counters could be automatically validated in our tests, and came up with these patches a few months ago. It turned out that progress counters can be checked easily and transparently in case of progress lines that are shown in the tests, i.e. that are shown even when stderr is not a terminal or are forced with '--progress'. (In other cases it's still fairly easy but not quite transparent, as I think we need changes to the progress API; more on that later in a separate series.) These checks did uncover a couple of buggy progress lines which are fixed in this series as well, but I'm not sure that the fix presented in patch 6 is the right approach, hence the RFC. SZEDER Gábor (7): progress: introduce GIT_TEST_CHECK_PROGRESS to verify progress counters progress: catch nested/overlapping progresses with GIT_TEST_CHECK_PROGRESS progress: catch backwards counting with GIT_TEST_CHECK_PROGRESS commit-graph: fix bogus counter in "Scanning merged commits" progress line entry: show finer-grained counter in "Filtering content" progress line [RFC] entry: don't show "Filtering content: ... done." line in case of errors test-lib: enable GIT_TEST_CHECK_PROGRESS by default commit-graph.c | 2 +- entry.c | 10 +++--- progress.c | 29 ++++++++++++++-- t/t0500-progress-display.sh | 69 +++++++++++++++++++++++++------------ t/test-lib.sh | 6 ++++ 5 files changed, 86 insertions(+), 30 deletions(-) -- 2.32.0.289.g44fbea0957