Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/lint-delimited-sections.perl # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / lint-delimited-sections.perl` 48 lines ยท 878 bytes Raw Blame History 1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 my $exit_code = 0; 7 sub report { 8 my ($msg) = @_; 9 print STDERR "$ARGV:$.: $msg\n"; 10 $exit_code = 1; 11 } 12 13 my $line_length = 0; 14 my $in_section = 0; 15 my $section_header = ""; 16 17 18 while (my $line = <>) { 19 if (($line =~ /^\+?$/) || 20 ($line =~ /^\[.*\]$/) || 21 ($line =~ /^ifdef::/)) { 22 $line_length = 0; 23 } elsif ($line =~ /^[^-.]/) { 24 $line_length = length($line); 25 } elsif (($line =~ /^-{3,}$/) || ($line =~ /^\.{3,}$/)) { 26 if ($in_section) { 27 if ($line eq $section_header) { 28 $in_section = 0; 29 } 30 next; 31 } 32 if ($line_length == 0) { 33 $in_section = 1; 34 $section_header = $line; 35 next; 36 } 37 if (($line_length != 0) && (length($line) != $line_length)) { 38 report("section delimiter not preceded by an empty line"); 39 } 40 $line_length = 0; 41 } 42 } 43 44 if ($in_section) { 45 report("section not finished"); 46 } 47 48 exit $exit_code;