diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-11-08 09:55:09 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-11-08 10:21:44 +0000 |
commit | 547142025a3ed969e8e80288dfa0540f8d672f12 (patch) | |
tree | 9ec8fc24f4fec0ac4f04cd5140a65c7293e689e2 /.githooks | |
parent | 8baeed5c9f45dcbc5ab770b0540482b55bd3a617 (diff) | |
download | aports-547142025a3ed969e8e80288dfa0540f8d672f12.tar.bz2 aports-547142025a3ed969e8e80288dfa0540f8d672f12.tar.xz |
githooks: skip checksum check for symlink
git will return the target of symlink instead of the content of the file
it points to, which makes the checksum check fail. To fix this we skip
checksum check if object is a symlink.
Diffstat (limited to '.githooks')
-rwxr-xr-x | .githooks/pre-commit | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 3901bc09de..be06c22512 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -55,6 +55,11 @@ abuild_local_sources() { return $status } +# check if given object is a symlink +is_symlink() { + test "$(git ls-files --stage "$1" | awk '{print $1}')" = "120000" +} + # Checks that all local sources specified in the APKBUILD file ($1) are # available in git tree and checksums are correct. check_local_sources() { @@ -73,6 +78,11 @@ check_local_sources() { status=1 continue fi + + if is_symlink ":$startdir/$filename"; then + continue + fi + checksum_act=$(git show ":$startdir/$filename" | sha512sum) if [ "$checksum_act" != "$checksum_exp -" ]; then error "$startdir: bad checksum for file \"$filename\" (hint: run abuild checksum)" |