Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
iMSTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository 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
Ruiliang Gao
iMSTK
Commits
cb0f7d3c
Commit
cb0f7d3c
authored
9 years ago
by
Alexis Girault
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add pre-commit hook
parent
b58ed9e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Utilities/GitHooks/pre-commit
+31
-0
31 additions, 0 deletions
Utilities/GitHooks/pre-commit
Utilities/SetupForDevelopment.sh
+1
-1
1 addition, 1 deletion
Utilities/SetupForDevelopment.sh
Utilities/SetupScripts/SetupGitHooks.sh
+0
-18
0 additions, 18 deletions
Utilities/SetupScripts/SetupGitHooks.sh
with
32 additions
and
19 deletions
Utilities/GitHooks/pre-commit
0 → 100755
+
31
−
0
View file @
cb0f7d3c
#!/usr/bin/env bash
#-----------------------------------------------------------------------------
# Define egrep-q
#-----------------------------------------------------------------------------
egrep-q
()
{
egrep
"
$@
"
>
/dev/null 2>/dev/null
}
#-----------------------------------------------------------------------------
# Define Error and Exit
#-----------------------------------------------------------------------------
printErrorAndExit
()
{
echo
'pre-commit hook failure'
1>&2
echo
'-----------------------'
1>&2
echo
''
1>&2
echo
"
$@
"
1>&2
exit
1
}
#-----------------------------------------------------------------------------
# Check that development setup is up-to-date
#-----------------------------------------------------------------------------
lastSetupForDevelopment
=
$(
git config
--get
setup.version
||
echo
0
)
eval
$(
grep
'^SetupForDevelopment_VERSION='
"
${
BASH_SOURCE
%/*
}
/../../Utilities/SetupForDevelopment.sh"
)
test
-n
"
$SetupForDevelopment_VERSION
"
||
SetupForDevelopment_VERSION
=
0
if
test
$lastSetupForDevelopment
-lt
$SetupForDevelopment_VERSION
;
then
printErrorAndExit
'Developer setup in this work tree is out of date. Please re-run
./Utilities/SetupForDevelopment.sh
'
fi
This diff is collapsed.
Click to expand it.
Utilities/SetupForDevelopment.sh
+
1
−
1
View file @
cb0f7d3c
...
...
@@ -54,4 +54,4 @@ echo
# this script and/or hooks have been modified.
#-----------------------------------------------------------------------------
SetupForDevelopment_VERSION
=
1
git config
hooks.SetupForDevelopment
${
SetupForDevelopment_VERSION
}
git config
setup.version
${
SetupForDevelopment_VERSION
}
This diff is collapsed.
Click to expand it.
Utilities/SetupScripts/SetupGitHooks.sh
+
0
−
18
View file @
cb0f7d3c
...
...
@@ -27,25 +27,7 @@ cd "${BASH_SOURCE%/*}/../GitHooks"
#-----------------------------------------------------------------------------
# Populate ".git/hooks"
#-----------------------------------------------------------------------------
echo
"Populating git hooks..."
git_dir
=
$(
git rev-parse
--git-dir
)
cp
*
$git_dir
/hooks
#-----------------------------------------------------------------------------
# Go to the project root directory
#-----------------------------------------------------------------------------
#cd "../.."
#-----------------------------------------------------------------------------
# Set up KWStyle hook
#-----------------------------------------------------------------------------
#echo "Setting up the KWStyle hook..."
#KWStyleConf="Utilities/KWStyle/iMSTK.kws.xml"
#KWStyleOverwriteConf="Utilities/KWStyle/iMSTKKWSOverwrite.txt"
#AssertFileExists $KWStyleConf
#AssertFileExists $KWStyleOverwriteConf
#git config hooks.KWStyle.conf $KWStyleConf
#git config hooks.KWStyle.overwriteRulesConf $KWStyleOverwriteConf
#git config hooks.KWStyle true
echo
"Done."
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