使用git进行开发:质量保证

来自Alpine Linux

在推送任何内容之前,最好确保

  1. 软件包可以实际构建
  2. 提交信息良好
  3. pkgrel 在需要时已提升
  4. 没有空白字符损坏(行尾字符是空白字符)

以下git钩子将帮助您尽早捕获一些常见错误

#!/bin/sh

# Redirect output to stderr.
exec 1>&2

git diff --cached --name-only HEAD | grep 'APKBUILD$' | while read f; do
        olddir=$PWD
        cd ${f%/APKBUILD}
        if ! abuild sanitycheck && verify; then
                exit 1
        fi
        cd "$olddir"
done

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached HEAD --

将其安装为 .git/hooks/pre-commit 并使其可执行。