summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.git-hooks/pre-commit2
-rwxr-xr-xsolenv/clang-format/check-last-commit5
2 files changed, 6 insertions, 1 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index 8c4e86345aa1..5ab539466827 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -204,6 +204,8 @@ sub check_style($)
print("and the clang-format rules. Fixing these now automatically.\n");
print("Running '$clang_format -i " . join(" ", @bad_names) . "' for you...\n");
system("$clang_format -i " . join(" ", @bad_names));
+ # TODO this stages all local modifications, staging originally
+ # unstaged hunks.
system("git add " . join(" ", @bad_names));
print("Done.\n");
}
diff --git a/solenv/clang-format/check-last-commit b/solenv/clang-format/check-last-commit
index 8c3628af76d1..2db666ab2aec 100755
--- a/solenv/clang-format/check-last-commit
+++ b/solenv/clang-format/check-last-commit
@@ -60,7 +60,10 @@ sub check_style()
if (scalar @bad_names)
{
print("\nERROR: The above differences were found between the code to commit \n");
- print("and the clang-format rules.\n");
+ print("and the clang-format rules. Tips:\n");
+ print("\n- You may run '/opt/lo/bin/clang-format -i <problematic file>' to fix up style automatically.\n");
+ print("- See solenv/clang-format/README on where to get the required version of clang-format binaries.\n");
+ print("- If you renamed a blacklisted file, update solenv/clang-format/blacklist accordingly to keep it blacklisted.\n");
print("\nsolenv/clang-format/check-last-commit: KO\n");
exit(1);
}