blob: 790d2a73cbf499164492a4924e8458bc4e414f4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/bash
##
# This is a git pre-commit hook which checks if PKGBUILD file has been updated
# and if so, generates .SRCINFO and adds it to the index before commit.
# Please save this file as .git/hooks/pre-commit and make it executable (chmod +x .git/hooks/pre-commit).
##
# fix environment of githooks
unset GIT_DIR
# if PKGBUILD has been altered, update .SRCINFO
for path in $(git diff --name-only --cached --diff-filter=AM); do
if [[ "${path}" =~ .*PKGBUILD$ ]]; then
echo -e "\e[01;32m *** Generating and adding .SRCINFO for ${path} ***\e[00m"
(makepkg --printsrcinfo > "${PWD}"/.SRCINFO) || exit 1
git update-index
git add "${PWD}"/.SRCINFO
fi
done
|