Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aron Helser
VTK
Commits
f226aad5
Commit
f226aad5
authored
Apr 23, 2010
by
Brad King
Browse files
pre-commit: Reject leading TABs
Our style guidelines do not permit indentation by TABs.
parent
5395049e
Changes
1
Hide whitespace changes
Inline
Side-by-side
pre-commit
View file @
f226aad5
...
...
@@ -51,3 +51,27 @@ fi
# Builtin whitespace checks.
bad
=
$(
git diff-index
--check
--cached
$against
--
)
||
die
"
$bad
"
# Reject leading TABs.
check_tab
()
{
git diff-index
-p
--cached
$against
--
"
$1
"
|
grep
'^+ '
>
/dev/null
&&
echo
"
$1
"
}
bad
=
$(
git diff-index
--name-only
--cached
$against
--
|
while
read
file
;
do
case
"
$file
"
in
*
.c
)
check_tab
"
$file
"
;;
*
.h
)
check_tab
"
$file
"
;;
*
.cxx
)
check_tab
"
$file
"
;;
*
.txx
)
check_tab
"
$file
"
;;
*
.hxx
)
check_tab
"
$file
"
;;
*
.htm
)
check_tab
"
$file
"
;;
*
.html
)
check_tab
"
$file
"
;;
*
.txt
)
check_tab
"
$file
"
;;
*
.cmake
)
check_tab
"
$file
"
;;
esac
done
)
test
-z
"
$bad
"
||
die
'Leading TABs added in
'
"
$bad
"
'
Convert them to spaces (2 per TAB) before commit.'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment