git hooks are useful to automate validation of certain common practices and conventions used by the repo, which maybe specified in the docs, but still (unintentionally) violated in changes being committed.
git hooks scripts are cross-platform (hint: git-win has sh.exe/bash.exe and so on) and thus have access to everything as the executing environment.
In dotnet/runtime, we can use them to validate:
- code being checked in inside
eng/common, which is the mirror directory sourced from arcade.
- native dependencies (brotli, libunwind etc.) code is being updated without updating their corresponding
{name}-version.txt file.
- format of commit message first (subject) line exceeding certain threshold.
- jit code is updated and
jit-format's output is not clean.
- C# code is update, dotnet-format is available, but
git show --name-only --pretty="" | xargs dotnet-format --include is not clean.
- change has invalid trailing whitespaces.
- change has new file without proper Unix-y EOF.
- more?
git hooks can be installed as part of bootstrap, e.g. ./install-hooks script which can be ran manually as well as invoked by top-level ./build script.
cc @janvorli, @jkotas, @danmosemsft
git hooksare useful to automate validation of certain common practices and conventions used by the repo, which maybe specified in the docs, but still (unintentionally) violated in changes being committed.git hooks scripts are cross-platform (hint: git-win has sh.exe/bash.exe and so on) and thus have access to everything as the executing environment.
In dotnet/runtime, we can use them to validate:
eng/common, which is the mirror directory sourced from arcade.{name}-version.txtfile.jit-format's output is not clean.git show --name-only --pretty="" | xargs dotnet-format --includeis not clean.git hooks can be installed as part of bootstrap, e.g. ./install-hooks script which can be ran manually as well as invoked by top-level ./build script.
cc @janvorli, @jkotas, @danmosemsft