summaryrefslogtreecommitdiff
path: root/.git-hooks
diff options
context:
space:
mode:
Diffstat (limited to '.git-hooks')
-rwxr-xr-x.git-hooks/pre-commit8
1 files changed, 7 insertions, 1 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index 27fba7e487a3..c7d51a1bcb2e 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -134,9 +134,15 @@ sub check_style($)
my ($h) = @_;
my $src = ClangFormat::get_extension_regex();
my @bad_names = ();
- my $excluded_list_names = ClangFormat::get_excludelist();
my $clang_format = ClangFormat::find();
+ ## Check if ClangFormat has get_excludelist or the old
+ ## get_blacklist
+ my $excluded_list_names;
+ eval { ClangFormat::get_excludelist() };
+ if ($@) { $excluded_list_names = ClangFormat::get_blacklist(); }
+ else { $excluded_list_names = ClangFormat::get_excludelist(); }
+
# Get a list of non-deleted changed files.
open (FILES, "git diff-index --cached --diff-filter=AM --name-only $h |") || die "Cannot run git diff.";
while (my $filename = <FILES>)