Skip to content
Snippets Groups Projects

githooks: ignore unstaged hunks of APKBUILD

Merged Casey requested to merge caleb/hook-staged-hunks-only into master
1 unresolved thread
+ 13
2
@@ -65,7 +65,7 @@ is_symlink() {
# available in git tree and checksums are correct.
check_local_sources() {
local apkbuild="$1"
local startdir="${apkbuild%/*}"
local startdir="$2"
local status=0
local checksum_act checksum_exp content filename line sources
@@ -92,6 +92,11 @@ check_local_sources() {
fi
done
# FIXME: probably not the right place to do this...
if [ "$(dirname "$apkbuild")" = "/tmp" ]; then
rm "$apkbuild"
fi
return $status
}
@@ -108,10 +113,16 @@ check_file_size() {
return 1
fi
}
cleanup() {
[ -f "$_staged" ] && rm "$_staged"
}
trap cleanup EXIT
for apkbuild in $(changed_files '**/APKBUILD'); do
check_local_sources "$apkbuild"
_staged="$(mktemp)"
git show ":$apkbuild" >"$_staged"
check_local_sources "$_staged" "${apkbuild%/*}"
done
for path in $(changed_files); do
Loading