]> gitweb.fluxo.info Git - git-hooks.git/commitdiff
Don't output error when checking files that have been removed and don't exists.
authorBenjamin C Meyer <ben@meyerhome.net>
Tue, 18 Feb 2014 03:49:23 +0000 (22:49 -0500)
committerBenjamin C Meyer <ben@meyerhome.net>
Tue, 18 Feb 2014 03:49:23 +0000 (22:49 -0500)
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
contrib/pre-commit/bash_syntax
contrib/pre-commit/copyright_year

index 5fecbfe722ca2d42f4d2e8267611c22e571c2c27..c2724b430a5877c51c52e6a85079637bb808ed9b 100755 (executable)
@@ -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
index 514d032aa175edd722c03a6911f8b4c445bc46e9..8f094d0e118e6b0a5b7963f1e41e1a88ddd4482d 100755 (executable)
@@ -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`