From 337c7ff042a9007b5b4fe84d65ba2e8cbbaf33f7 Mon Sep 17 00:00:00 2001 From: George Owusu Date: Wed, 12 Oct 2022 16:48:46 +0100 Subject: [PATCH] Revert "Fix: git add bug (#300)" This reverts commit a517ba88ff2f491218b6bbfafa28dd01c412f9eb. --- .githooks/pre-commit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit old mode 100644 new mode 100755 index 56fc9fb4..b3d0af8f --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -4,7 +4,7 @@ set -e JSONNET_FILES_CHANGED=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep "sonnet" | wc -l) DOCKERFILE_CHANGED=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep "Dockerfile" | wc -l) -SHELL_FILE_CHANGED=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep -E ".sh$" | wc -l) +SHELL_FILE_CHANGED=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep ".sh" | wc -l) MD_FILES_CHANGED=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep -E ".md|.md.erb" | wc -l) REPO_ROOT_DIR=$(git rev-parse --show-toplevel) @@ -12,7 +12,7 @@ REPO_ROOT_DIR=$(git rev-parse --show-toplevel) if [ "$JSONNET_FILES_CHANGED" -gt "0" ]; then $REPO_ROOT_DIR/monitoring-as-code/fmt.sh $REPO_ROOT_DIR/monitoring-as-code/lint.sh - git add $(git diff --name-only --cached) + git add $REPO_ROOT_DIR fi if [ "$DOCKERFILE_CHANGED" -gt "0" ]; then @@ -24,7 +24,7 @@ if [ "$DOCKERFILE_CHANGED" -gt "0" ]; then fi if [ "$SHELL_FILE_CHANGED" -gt "0" ]; then - shell_files=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep -E ".sh$") + shell_files=$(git --no-pager diff --cached --name-only --diff-filter=ACM | grep ".sh") for shell_file in $shell_files do echo $shell_file | xargs docker run --rm -v "$REPO_ROOT_DIR:/mnt" koalaman/shellcheck:stable