From f9a55cb0afc9e85cb9272e453d780962cbc515e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 28 Sep 2015 16:52:12 -0700 Subject: [PATCH] Unify metadata checks in verify-rewritemeta.sh --- hooks/pre-commit | 9 +-------- tools/verify-rewritemeta.sh | 15 +++++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index c590f79cb5..661f8ae23c 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,10 +1,3 @@ #!/bin/sh -# -# Simple pre-commit hook to check that there are no errors in the fdroid -# metadata files. -# Redirect output to stderr. -exec 1>&2 - -# If there are metadata errors, print the stack traces and fail. -exec fdroid readmeta +./tools/verify-rewritemeta.sh diff --git a/tools/verify-rewritemeta.sh b/tools/verify-rewritemeta.sh index 0dd981fe50..9ce0cfbe71 100755 --- a/tools/verify-rewritemeta.sh +++ b/tools/verify-rewritemeta.sh @@ -1,15 +1,18 @@ #!/bin/bash -# Verify that rewritemeta has been run. +# Check that there are no errors in the metadata files and that they are +# formatted correctly. -set -e +set -o errexit +set -o nounset +set -o pipefail + +# Redirect output to stderr. +exec 1>&2 files=$(fdroid rewritemeta -l) - if [[ -n "$files" ]]; then - echo "Run fdroid rewritemeta to fix formatting on these files:" + echo "ERROR: Run rewritemeta to fix formatting on these files:" echo "$files" exit 1 fi - -exit 0