aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin C Meyer <ben@meyerhome.net>2014-02-17 22:49:23 -0500
committerBenjamin C Meyer <ben@meyerhome.net>2014-02-17 22:49:23 -0500
commitfeae1e052ede35ca02a4643e91d60eb33e876bb2 (patch)
tree5e636dba9b270f5d9159ac3ab5bda71d039fca95
parent6aa63a32a404850e2e20b9229a0a7fe8f6096fa8 (diff)
downloadgit-hooks-feae1e052ede35ca02a4643e91d60eb33e876bb2.tar.gz
git-hooks-feae1e052ede35ca02a4643e91d60eb33e876bb2.tar.bz2
Don't output error when checking files that have been removed and don't exists.
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
-rwxr-xr-xcontrib/pre-commit/bash_syntax5
-rwxr-xr-xcontrib/pre-commit/copyright_year5
2 files changed, 8 insertions, 2 deletions
diff --git a/contrib/pre-commit/bash_syntax b/contrib/pre-commit/bash_syntax
index 5fecbfe..c2724b4 100755
--- a/contrib/pre-commit/bash_syntax
+++ b/contrib/pre-commit/bash_syntax
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (c) 2010, Benjamin C. Meyer <ben@meyerhome.net>
+# Copyright (c) 2010-2014, Benjamin C. Meyer <ben@meyerhome.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,9 @@
function test_file {
file="${1}"
+ if [ ! -f "${file}" ] ; then
+ return
+ fi
head -n 1 "${file}" | grep 'bash' | grep '^#!/' > /dev/null
if [ "$?" -eq 0 ] ; then
set -e
diff --git a/contrib/pre-commit/copyright_year b/contrib/pre-commit/copyright_year
index 514d032..8f094d0 100755
--- a/contrib/pre-commit/copyright_year
+++ b/contrib/pre-commit/copyright_year
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (c) 2010, Benjamin C. Meyer <ben@meyerhome.net>
+# Copyright (c) 2010-2014, Benjamin C. Meyer <ben@meyerhome.net>
# Copyright (c) 2013, Phil Black-Knight <pblack88@gmail.com>
# All rights reserved.
#
@@ -29,6 +29,9 @@
function test_file {
file="${1}"
+ if [ ! -f "${file}" ] ; then
+ return
+ fi
if grep 'Copyright ' "${file}" | grep -v grep >/dev/null
then
year=`date +%Y`