File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
{{ .ProjectSnake }}/githooks Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 33git diff --cached --diff-filter=AM --name-only -z | xargs --null --no-run-if-empty bash -c '
44 if [ $# -gt 0 ]; then
55 echo "Formatting staged files: $@"
6+ # Avoid running bazel to build the formatter.
7+ # In theory it' s more correct to build it since the one in bazel-out may be out-of-date.
8+ # However a 'git commit' operation should always be fast, and accidental analysis or action cache misses are common.
9+ # So we take the tradeoff of running the existing binary if it exists.
610 if [ -e " bazel-out/bazel_env-opt/bin/tools/bazel_env/bin/format" ]; then
711 bazel-out/bazel_env-opt/bin/tools/bazel_env/bin/format " $@ "
812 else
9- bazel run //: format -- "$@"
13+ bazel run //tools/ format -- " $@ "
1014 fi
1115
1216 # Check if any of the staged files were modified by the formatter
You can’t perform that action at this time.
0 commit comments