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>
This commit is contained in:
+22
-25
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user