3 ## SPDX-License-Identifier: GPL-2.0-only
5 # In the hooks, use the same `make` tool as used when running `make gitconfig`,
6 # e.g. `remake gitconfig` will set `remake` to be run by the hooks.
9 if ! { cdup
="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; }
11 echo "Error: Not in root of a git repository"
14 coreboot_hooks
=$
(git rev-parse
--git-path hooks
)
15 mkdir
-p "${coreboot_hooks}"
16 for hook
in commit-msg pre-commit
; do
17 if [ util
/gitconfig
/${hook} -nt "${coreboot_hooks}/${hook}" ] \
18 || [ ! -x "${coreboot_hooks}/${hook}" ]
20 sed -e "s
,%MAKE
%,${MAKE},g
" util/gitconfig/$hook \
21 > "${coreboot_hooks}/${hook}"
22 chmod +x "${coreboot_hooks}/${hook}"
25 # Now set up the hooks for 3rdparty/
26 for submodule in 3rdparty/blobs libhwbase libgfxinit; do
27 hooks=$(git -C "$
(git config
--file .gitmodules
--get \
28 submodule.
${submodule}.path
)" rev-parse --git-path hooks)
29 if [ -d "${hooks}" ]; then
30 if [ util/gitconfig/commit-msg -nt "${hooks}/commit-msg
" ] \
31 || [ ! -x "${hooks}/commit-msg
" ]
33 sed -e "s
,%MAKE
%,${MAKE},g
" util/gitconfig/commit-msg \
34 > "${hooks}/commit-msg
"
35 chmod +x "${hooks}/commit-msg
"
39 for d in 3rdparty/{blobs,libhwbase,libgfxinit}; do
42 git config remote.origin.push HEAD:refs/for/main)
46 git config remote.origin.push HEAD:refs/for/main
47 git config alias.sup "!git submodule update
--remote --rebase && \
48 git submodule update
--init --checkout"
50 git config alias.sup-destroy "!git submodule deinit
--all --force; \
51 git submodule update
--init --checkout"
53 { git config --includes user.name && \
54 git config --includes user.email; } >/dev/null || \
56 Please configure your name and email in git:
58 git config --global user.name "Your Name Comes Here
"
59 git config --global user.email your.email@example.com