xref: /aosp_15_r20/external/coreboot/util/scripts/prepare-commit-msg.clang-format (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1#!/usr/bin/env bash
2files=`git diff --cached --name-only | grep '\.[ch]$'`
3if [ -z "$files" ]; then
4	exit 0
5fi
6# This has to be set here; otherwise a grep error seems to cause
7# us to exit with non-zero status.
8set -e
9clang-format -i $files
10git add $files
11u=`git config user.name`
12m="clang-formatted-by: $u"
13echo $m >> $1
14