From a07f1af706271a4a10450a8ee956290918ec3fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 20 Jun 2016 11:18:31 +0100 Subject: [PATCH] pre-commit: do nothing if no apps are changed Otherwise, we'd run lint on every single app. --- hooks/pre-commit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 007f273e98..fa2186850c 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset @@ -7,5 +7,8 @@ set -o pipefail # Redirect output to stderr. exec 1>&2 +apps="$(git diff --cached --name-only --diff-filter=ACM | sed -n 's@metadata/\(.*\).txt@\1@p')" -fdroid lint -f $(git diff --cached --name-only --diff-filter=ACM | sed -n 's@metadata/\(.*\).txt@\1@p') +if [[ -n "$apps" ]]; then + fdroid lint -f $apps +fi