From 8fe5e5f73c33964e2d2413f383a964ee66ace6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 5 Sep 2022 12:51:26 +0200 Subject: [PATCH] hooks: use AWK instead of jq for better portability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some systems don't have jq installed, and using something like `nix-shell` in the shebang would make this script noticeably slower. We're not using `grep` because it lacks `-P` flag on MacOS. Resolves: https://github.com/status-im/status-mobile/issues/13322 Signed-off-by: Jakub SokoĊ‚owski --- scripts/hooks/prepare-commit-msg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/hooks/prepare-commit-msg b/scripts/hooks/prepare-commit-msg index 6031019366..32e908d71b 100755 --- a/scripts/hooks/prepare-commit-msg +++ b/scripts/hooks/prepare-commit-msg @@ -6,8 +6,8 @@ if [[ -z $(git diff --cached --name-only -r | grep status-go-version.json) ]]; t fi MERGE_BASE=$(git merge-base -a develop "$(git rev-parse --abbrev-ref HEAD)" develop) -GO_COMMIT_MERGE_BASE=$(git show "${MERGE_BASE}":status-go-version.json | jq -r '."commit-sha1"') -GO_COMMIT_CURRENT=$(jq -r '."commit-sha1"' status-go-version.json) +GO_COMMIT_MERGE_BASE=$(git show "${MERGE_BASE}":status-go-version.json | awk -F'"' '/commit-sha1/{print $4}') +GO_COMMIT_CURRENT=$(awk -F'"' '/commit-sha1/{print $4}' status-go-version.json) GITHUB_LINK_PREFIX="https://github.com/status-im/status-go/compare/" # Link to the current StatusGo changelog being updated. GITHUB_LINK="${GITHUB_LINK_PREFIX}${GO_COMMIT_MERGE_BASE::8}...${GO_COMMIT_CURRENT::8}"