summaryrefslogtreecommitdiff
path: root/.git-hooks
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-21 09:52:10 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-11-21 11:16:11 +0100
commit46ab76a7090b5e04105986df16efaa63ea0cc58a (patch)
treece84776e1aad20b472776097ce06c50a7b979011 /.git-hooks
parent95e3e5b83b2b7be86310f38aeae60cd4bc83939b (diff)
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>
Diffstat (limited to '.git-hooks')
-rwxr-xr-x.git-hooks/pre-commit10
1 files changed, 9 insertions, 1 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index e83e3a36648a..c0464e1c0778 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -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 = ();