From fb0ebae8a89383354d3c8ee59f63c3f55141f6a4 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Thu, 21 Sep 2023 19:58:18 +0200 Subject: [PATCH] Use more context to detect real commits with heuristics in cvslog. --- cvslog.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cvslog.pl b/cvslog.pl index 129e257d..5ec6e19a 100755 --- a/cvslog.pl +++ b/cvslog.pl @@ -89,10 +89,17 @@ my $state = "header"; my $file; my %commit; -while (<$cvs>) { +for ((local $_, my $preview) = (scalar <$cvs>, scalar <$cvs>); + defined($_); + ($_, $preview) = ($preview, scalar <$cvs>)) { + print if $verbose; chomp; - if ($_ eq $startcommit || $_ eq $finishcommit) { + # some commit messages contain ---------------------------- + # use more context to detect real commits with heuristics + if (($_ eq $startcommit && $preview =~ /^revision 1\./) || + $_ eq $finishcommit) { + $file or die "No file before commit: $_"; if ($state eq "header") { my @keys = keys %commit;