Development using git:Quality assurance: Difference between revisions

From Alpine Linux
(Removed the Move tag. Made the document part of Git Workflow in git page)
Tag: Manual revert
m (changed unnumberedd list to numbered list)
Line 1: Line 1:
Before pushing anything to it is good to make sure that:
Before pushing anything to it is good to make sure that:
* The package actually builds
# The package actually builds
* Commit message is good
# Commit message is good
* pkgrel is bumped if needed
# pkgrel is bumped if needed
* no whitespace damage (last chars of a line is whitespace)
# no whitespace damage (last chars of a line is whitespace)


The following git hook will help you catch some common errors early:
The following git hook will help you catch some common errors early:

Revision as of 09:42, 14 August 2024

Before pushing anything to it is good to make sure that:

  1. The package actually builds
  2. Commit message is good
  3. pkgrel is bumped if needed
  4. no whitespace damage (last chars of a line is whitespace)

The following git hook will help you catch some common errors early:

#!/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 --

Install it as .git/hooks/pre-commit and make it executable.

See Also