From f383f8282eef0ef175cb5c770bbce0e1aac1d969 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 31 Mar 2023 10:13:16 +0200 Subject: [PATCH] aset fsize only when file exists --- .githooks/post-merge | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.githooks/post-merge b/.githooks/post-merge index fece6e7..8ff70b3 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -19,8 +19,10 @@ rm -f $OPKG_CMDS_TMP for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then - fsize=$(ls -l $fn | awk '{ print $5 }') - # add size so external programs can check + fsize=0 + if [[ -f "$fn" ]]; then + fsize=$(ls -l "$fn" | awk '{ print $5 }') + fi echo "$fn $fsize" >> $GIT_PULL_TMP fi if grep -E -q ".*opkg_commands" <<< $fn; then