summaryrefslogtreecommitdiff
path: root/.git-hooks
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-16 12:08:11 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-11-16 20:24:46 +0100
commitea5339e31cf19b3a8f3417a10711d55b3944fbd4 (patch)
treea2b6a4cc8457437830749131739d1fef0bb6e8f1 /.git-hooks
parent38d0142556dfb96465f70cabca9018780d9e810c (diff)
git-hooks: mention download link for clang-format when warning about it
Change-Id: I99f2154bb3d15fe4a99c1d27ca20756e1fb31cec Reviewed-on: https://gerrit.libreoffice.org/44810 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
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)