pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - It is an error if a hunk in a...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/80dbd4edf554
branches:  trunk
changeset: 509030:80dbd4edf554
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Mar 02 13:08:37 2006 +0000

description:
- It is an error if a hunk in a patch contains fewer lines that what is
  specified in the hunk header.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 7c23c491e109 -r 80dbd4edf554 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Mar 02 12:23:56 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Mar 02 13:08:37 2006 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index