mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-06 10:29:00 +00:00
hooks: add hook chains for development checks and LFS
This commit is contained in:
parent
867f0a069f
commit
bea0a7e38e
6
.hooks-config
Normal file
6
.hooks-config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Loaded by .git/hooks/(pre-commit|commit-msg|prepare-commit-msg)
|
||||||
|
# during git commit after local hooks have been installed.
|
||||||
|
|
||||||
|
[hooks "chain"]
|
||||||
|
pre-commit = utilities/git/pre-commit
|
||||||
|
pre-push = utilities/git/pre-push
|
@ -28,3 +28,6 @@ echo "Set up git gitlab-push" &&
|
|||||||
git config alias.gitlab-sync '!bash Utilities/GitSetup/git-gitlab-sync' &&
|
git config alias.gitlab-sync '!bash Utilities/GitSetup/git-gitlab-sync' &&
|
||||||
echo "Set up git gitlab-sync" &&
|
echo "Set up git gitlab-sync" &&
|
||||||
true
|
true
|
||||||
|
|
||||||
|
SetupForDevelopment=1
|
||||||
|
git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}
|
||||||
|
24
Utilities/hooks/pre-commit
Executable file
24
Utilities/hooks/pre-commit
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
die() {
|
||||||
|
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 hooks.SetupForDevelopment || echo 0)
|
||||||
|
eval $(grep '^SetupForDevelopment_VERSION=' "${BASH_SOURCE%/*}/../SetupForDevelopment.sh")
|
||||||
|
test -n "$SetupForDevelopment_VERSION" || SetupForDevelopment_VERSION=0
|
||||||
|
if test $lastSetupForDevelopment -lt $SetupForDevelopment_VERSION; then
|
||||||
|
die 'Developer setup in this work tree is out of date. Please re-run
|
||||||
|
|
||||||
|
Utilities/SetupForDevelopment.sh
|
||||||
|
'
|
||||||
|
fi
|
3
Utilities/hooks/pre-push
Executable file
3
Utilities/hooks/pre-push
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path.\n"; exit 2; }
|
||||||
|
git lfs pre-push "$@"
|
Loading…
Reference in New Issue
Block a user