Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
c9650412
Commit
c9650412
authored
12 years ago
by
Russell Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Re #6086. Some tidying up.
parent
e41a79b5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.githooks/pre-commit
+20
-16
20 additions, 16 deletions
.githooks/pre-commit
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
with
23 additions
and
16 deletions
.githooks/pre-commit
+
20
−
16
View file @
c9650412
...
@@ -146,23 +146,25 @@ test -n "$size_max_KiB" || size_max_KiB=1024
...
@@ -146,23 +146,25 @@ test -n "$size_max_KiB" || size_max_KiB=1024
size_too_large_once
=
""
size_too_large_once
=
""
size_too_large_once
()
{
size_too_large_once
()
{
test
-z
"
$size_too_large_once
"
||
return
;
size_too_large_once
=
done
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
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
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
*.c hooks.MaxObjectKiB=2048
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
sets a limit of 2048 KiB for C source files. See "git help attributes"
http://www.mantidproject.org/Unit_Test_Good_Practice#Using_files_in_Unit_tests).
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).
'
'
# 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
()
{
size_too_large_once
size_too_large_once
...
@@ -175,8 +177,10 @@ size_validate_max_KiB() {
...
@@ -175,8 +177,10 @@ size_validate_max_KiB() {
}
}
check_size
()
{
check_size
()
{
test
"
$dst_obj
"
!=
"
$zero
"
||
return
test
"
$dst_obj
"
!=
"
$zero
"
||
return
max_KiB
=
$(
git check-attr hooks.MaxObjectKiB
--
"
$file
"
|
datesuffix
=
`
date
+%y%m%d
`
sed
's/^[^:]*: hooks.MaxObjectKiB: //'
)
hookname
=
'hooks.MaxObjectKiB'
$datesuffix
max_KiB
=
$(
git check-attr
$hookname
--
"
$file
"
|
sed
"s/^[^:]*:
${
hookname
}
: //"
)
case
"
$max_KiB
"
in
case
"
$max_KiB
"
in
'unset'
)
return
;;
# No maximum for this object.
'unset'
)
return
;;
# No maximum for this object.
'set'
)
max_KiB
=
"
$size_max_KiB
"
;;
# Use local default.
'set'
)
max_KiB
=
"
$size_max_KiB
"
;;
# Use local default.
...
...
This diff is collapsed.
Click to expand it.
.gitignore
+
3
−
0
View file @
c9650412
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
# **** 'Personal' entries don't belong in here - put them in your .git/info/exclude file ****
# **** '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
# Ignore text editor (e.g. emacs) autosave files
*~
*~
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment