Commit b32ecce7 authored by Gaëtan Lehmann's avatar Gaëtan Lehmann Committed by Matt McCormick

make the check for KWStyle executable non blocking

At this time, a contributor won't be able to commit a change if KWStyle
is not installed on the computer. KWStyle is not a very common program,
and so is likely to have to be installed by hand. This increase the work
needed to be able to contribute to ITK.
With this change a warning is displayed if KWStyle is not installed
but the commit is not blocked.

Change-Id: I0719ee5ac6e048120504bbdc4dc022043c0f0ded
parent c4607863
......@@ -77,15 +77,20 @@ Allow skipping the style check for this commit with
# KWStyle.
check_for_KWStyle() {
KWStyle_path=$(git config hooks.KWStyle.path) ||
KWStyle_path=$(which KWStyle) ||
die "KWStyle executable was not found.
KWStyle_path=$(which KWStyle)
if [ $? != 0 ] ; then
echo "KWStyle executable was not found.
No style verification will be performed with KWStyle!
Please install KWStyle or set the executable location with
git config hooks.KWStyle.path /path/to/KWStyle
See http://public.kitware.com/KWStyle/"
See http://public.kitware.com/KWStyle/
" >&2
return 1
fi
KWStyle_conf=$(git config hooks.KWStyle.conf)
if ! test -f "$KWStyle_conf"; then
die "The file '$KWStyle_conf' does not exist.
......@@ -201,7 +206,10 @@ run_uncrustify_on_file() {
fi # end if run uncrustify on file
if $do_KWStyle && run_style_on_file "$MERGED" KWStyle; then
if $do_KWStyle &&
$have_KWStyle &&
run_style_on_file "$MERGED" KWStyle
then
run_KWStyle_on_file "$MERGED"
else
return 0
......@@ -210,6 +218,11 @@ run_uncrustify_on_file() {
run_uncrustify() {
$do_KWStyle && check_for_KWStyle
if test $?; then
have_KWStyle=false
else
have_KWStyle=true
fi
merge_tool=$(get_merge_tool "$merge_tool") || die "Merge tool not configured.
......@@ -245,8 +258,9 @@ elif $do_uncrustify; then
# do_uncrustify will run KWStyle on the files incrementally so excessive
# uncrustify merges do not have to occur.
elif $do_KWStyle; then
check_for_KWStyle
run_KWStyle
if check_for_KWStyle; then
run_KWStyle
fi
fi
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment