From c9650412ec1cf1fecf422eef16589b8e815771d6 Mon Sep 17 00:00:00 2001
From: Russell Taylor <taylorrj@ornl.gov>
Date: Fri, 7 Dec 2012 15:19:29 -0500
Subject: [PATCH] Re #6086. Some tidying up.

---
 .githooks/pre-commit | 36 ++++++++++++++++++++----------------
 .gitignore           |  3 +++
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 8812d647fcc..3ae5c2a03a4 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -146,23 +146,25 @@ test -n "$size_max_KiB" || size_max_KiB=1024
 size_too_large_once=""
 size_too_large_once() {
 	test -z "$size_too_large_once" || return ; size_too_large_once=done
-	echo 'At least one file is staged for commit with size larger than its limit.
+	echo 'At least one file is staged for commit with size larger than the limit.
 We prefer to keep large files out of the main source tree, especially
-binary files that do not compress well.  This hook disallows large files
-by default but can be configured.  A limit for specific files or patterns
-may be set in ".gitattributes" with the "hooks.MaxObjectKiB" attribute.
-For example, the line
+binary files that do not compress well.  This hook disallows large files.
 
-  *.c              hooks.MaxObjectKiB=2048
-
-sets a limit of 2048 KiB for C source files.  See "git help attributes"
-for details on the .gitattributes format.  If no attribute has been set
-for a given file then its size is limited by the local default.  Run
-
-  git config hooks.MaxObjectKiB $KiB
-
-to set the local default limit (0 to disable).
+If it is vital that this file enters the repository, speak to a dev lead.
+Remember that unit tests should typically not require loading files (see
+http://www.mantidproject.org/Unit_Test_Good_Practice#Using_files_in_Unit_tests).
 '
+# Instructions for allowing ESSENTIAL files only:
+#   A limit for specific files or patterns may be set in ".gitattributes" with
+#   the "hooks.MaxObjectKiBYYMMDD" attribute (where YYMMDD is the current date).
+#   For example, the line
+#
+#     *.c              hooks.MaxObjectKiB121207=2048
+#
+#   sets a limit of 2048 KiB for C source files, but WILL ONLY WORK on the date
+#   matching the entry. This avoids the previous behaviour that once set the
+#   hook was forever disabled if the entry was not removed afterwards.
+#   See "git help attributes" for details on the .gitattributes format.
 }
 size_too_large() {
 	size_too_large_once
@@ -175,8 +177,10 @@ size_validate_max_KiB() {
 }
 check_size() {
 	test "$dst_obj" != "$zero" || return
-	max_KiB=$(git check-attr hooks.MaxObjectKiB -- "$file" |
-		  sed 's/^[^:]*: hooks.MaxObjectKiB: //')
+	datesuffix=`date +%y%m%d`
+	hookname='hooks.MaxObjectKiB'$datesuffix
+	max_KiB=$(git check-attr $hookname -- "$file" |
+		  sed "s/^[^:]*: ${hookname}: //")
 	case "$max_KiB" in
 		'unset')       return ;; # No maximum for this object.
 		'set')         max_KiB="$size_max_KiB" ;; # Use local default.
diff --git a/.gitignore b/.gitignore
index 2b9752749ab..801503d3ed2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
 
 # **** 'Personal' entries don't belong in here - put them in your .git/info/exclude file ****
 
+# Ignore gitatrributes file
+.gitattributes
+
 # Ignore text editor (e.g. emacs) autosave files
 *~
 
-- 
GitLab