git-hooks: fix pre-commit in submodules

translations.git failed with "Can't locate ClangFormat.pm in @INC (you
may need to install the ClangFormat module)".

Change-Id: Ibbe051c1cb4c1200da58821589b8271434b1f9a6
Reviewed-on: https://gerrit.libreoffice.org/45020
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Miklos Vajna 2017-11-21 09:52:10 +01:00
parent 95e3e5b83b
commit 46ab76a709

View file

@ -7,7 +7,6 @@
use strict;
use lib "solenv/clang-format";
use ClangFormat;
#use File::Copy;
#use Cwd;
@ -112,6 +111,15 @@ sub check_whitespaces($)
sub check_style($)
{
if (! -e "solenv/clang-format/ClangFormat.pm")
{
# Commit happens in a submodule.
return;
}
require ClangFormat;
ClangFormat->import();
my ($h) = @_;
my $src = ClangFormat::get_extension_regex();
my @bad_names = ();