diff options
author | Tom Willemse | 2014-03-05 00:26:26 +0100 |
---|---|---|
committer | Tom Willemse | 2014-03-05 00:26:26 +0100 |
commit | 06abe8cbc73e43426b1aa983331dde5c36460c0a (patch) | |
tree | 7b4550d5ad6d493581fe195fe11598a3d7964ca8 | |
parent | a4279c3b6bd18b2aaeb9359f91c4f207d6f3e425 (diff) | |
download | commit-check-06abe8cbc73e43426b1aa983331dde5c36460c0a.tar.gz commit-check-06abe8cbc73e43426b1aa983331dde5c36460c0a.zip |
Check file given as first argument
Check the file whose name has been specified on the command line for
errors, instead of `stdin'. Git passes the file name of the file
containing the commit message instead of passing the commit message to
`stdin'.
This was supposed to be committed in the first commit. but somehow it
got lost.
-rwxr-xr-x | commit-check | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/commit-check b/commit-check index 6543633..3cfd7c6 100755 --- a/commit-check +++ b/commit-check @@ -12,7 +12,9 @@ sub err { $status = 1; } -while (<>) { +open(my $commitfile, "<", $ARGV[0]) or die "Couldn't open $ARGV[0]"; + +while (<$commitfile>) { next if /^#/; # Discard comments next if $lineno == 0 && /^$/; # Discard leading empty lines $lineno++; # Start at 1, so increment first @@ -27,4 +29,5 @@ while (<>) { err "Longer than 80 characters" if /^.{73,}/; } +close $commitfile; exit $status; |