summaryrefslogtreecommitdiff
path: root/.git-hooks
diff options
context:
space:
mode:
Diffstat (limited to '.git-hooks')
-rwxr-xr-x.git-hooks/pre-commit47
1 files changed, 22 insertions, 25 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index 80f2e0b4c591..298ebc4f1d9f 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -148,31 +148,6 @@ sub check_style($)
}
}
-# # Check if clang-format is installed.
-# if (! -x $clang_format)
-# {
-# my $platform = "linux64";
-# my $download = "wget";
-# if ($^O eq "cygwin")
-# {
-# $platform = "win.exe";
-# }
-# elsif ($^O eq "darwin")
-# {
-# $platform = "mac";
-# $download = "curl -O";
-# }
-#
-# print("Error: clang-format is not found in $opt_lo or in your PATH.\n");
-# print("To get a clang-format binary for your platform, please do:\n\n");
-# print("mkdir -p $opt_lo\n");
-# print("cd $opt_lo\n");
-# print("$download https://dev-www.libreoffice.org/bin/clang-format-$version-$platform\n");
-# print("cp clang-format-$version-$platform clang-format\n");
-# print("chmod +x clang-format\n");
-# exit(1);
-# }
-
# Read the blacklist.
if (open(LINES, "solenv/clang-format/blacklist"))
{
@@ -201,6 +176,28 @@ sub check_style($)
print("\nWARNING: Commit touches new (non-blacklisted) files, but no clang-format"
. " ${version}\n");
print(" found (via CLANG_FORMAT or PATH env vars, or in ${opt_lo}).\n\n");
+
+ my $platform = "linux64";
+ my $download = "wget";
+ if ($^O eq "cygwin")
+ {
+ $platform = "win.exe";
+ }
+ elsif ($^O eq "darwin")
+ {
+ $platform = "mac";
+ $download = "curl -O";
+ }
+
+ print("To get a suitable binary, please do:\n\n");
+ print("mkdir -p $opt_lo\n");
+ print("cd $opt_lo\n");
+ print("$download https://dev-www.libreoffice.org/bin/clang-format-$version-$platform\n");
+ print("cp clang-format-$version-$platform clang-format\n");
+ print("chmod +x clang-format\n\n");
+
+ print("(Or read the instructions how to build it yourself at\n");
+ print("<https://dev-www.libreoffice.org/bin/README.clang-format.txt>).\n\n");
return;
}
if (system("$clang_format $filename | git --no-pager diff --no-index --exit-code $filename -") != 0)