diff options
author | rillig <rillig@pkgsrc.org> | 2006-03-02 13:08:37 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2006-03-02 13:08:37 +0000 |
commit | ecf6e1d01936aa74735403231a313ad4d13e0e39 (patch) | |
tree | 61998b93ac49b45f2e214c7c8a076b15ecb1b82e | |
parent | adc077839f1d43499e0044d79a76cc662c85723d (diff) | |
download | pkgsrc-ecf6e1d01936aa74735403231a313ad4d13e0e39.tar.gz |
- It is an error if a hunk in a patch contains fewer lines that what is
specified in the hunk header.
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 1fc7f19e6a4..b155a4fd71f 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.540 2006/03/02 10:37:43 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.541 2006/03/02 13:08:37 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -4327,10 +4327,16 @@ sub checkfile_patch($) { my $check_hunk_end = sub($$$) { my ($deldelta, $adddelta, $newstate) = @_; - if ($deldelta < 0 && $dellines == 0) { + if ($deldelta > 0 && $dellines == 0) { $redostate = $newstate; - } elsif ($adddelta < 0 && $addlines == 0) { + if (defined($addlines) && $addlines > 0) { + $line->log_error("Expected ${addlines} more lines to be added."); + } + } elsif ($adddelta > 0 && $addlines == 0) { $redostate = $newstate; + if (defined($dellines) && $dellines > 0) { + $line->log_error("Expected ${dellines} more lines to be deleted."); + } } else { if ($deldelta != 0) { $dellines -= $deldelta; |