Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
OpenXG-RAN
Commits
fa9b91ad
Commit
fa9b91ad
authored
Feb 24, 2017
by
Cedric Roux
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/pre-commit-hook' into develop_integration_w08
parents
2c238010
068ce4ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
pre-commit
pre-commit
+31
-0
No files found.
pre-commit
0 → 100644
View file @
fa9b91ad
#!/bin/bash
# Installation:
# cp pre-commit .git/hooks
# chmod +x .git/hooks/pre-commit
OPTIONS
=
"--convert-tabs --indent=spaces=2 --indent-switches --indent-col1-comments --break-blocks --delete-empty-lines --align-pointer=name --keep-one-line-blocks --keep-one-line-statements --lineend=linux"
RETURN
=
0
ASTYLE
=
$(
which astyle
)
if
[
$?
-ne
0
]
;
then
echo
"[!] astyle not installed. Unable to check source file format policy."
>
&2
exit
1
fi
FILES
=
`
git diff
--cached
--name-only
--diff-filter
=
ACMR |
grep
-E
"
\.
(c|cpp|h)$"
`
for
FILE
in
$FILES
;
do
$ASTYLE
$OPTIONS
<
$FILE
| cmp
-s
$FILE
-
if
[
$?
-ne
0
]
;
then
echo
"[!]
$FILE
does not respect the agreed coding style."
>
&2
RETURN
=
1
fi
done
if
[
$RETURN
-eq
1
]
;
then
echo
""
>
&2
echo
"Make sure you have run astyle with the following options:"
>
&2
echo
$OPTIONS
>
&2
fi
exit
$RETURN
\ No newline at end of file
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