From eeab82e9d78339bbd75904ac3bfee51ee1025f04 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 19 Feb 2025 20:01:03 +0100 Subject: [PATCH] tools: improve in-repo check Signed-off-by: Karel Zak --- tools/git-tp-sync | 7 +++---- tools/git-version-bump | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/git-tp-sync b/tools/git-tp-sync index 00c847b91..e9170660b 100755 --- a/tools/git-tp-sync +++ b/tools/git-tp-sync @@ -52,11 +52,10 @@ while [[ $# -gt 0 ]]; do esac done -git rev-parse --is-inside-work-tree &> /dev/null -if [ "$?" -ne 0 ]; then - echo "Must be called within a Git working tree." +git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { + echo "Error: Not inside a Git repository." >&2 exit 1 -fi +} # default to all dirs defined by TP_PROJECTS if [ ${#DIRS[@]} -eq 0 ]; then diff --git a/tools/git-version-bump b/tools/git-version-bump index d4d32a019..17db88028 100755 --- a/tools/git-version-bump +++ b/tools/git-version-bump @@ -11,12 +11,10 @@ if [ -z "$VERSION" ]; then exit 1 fi -git rev-parse --is-inside-work-tree &> /dev/null -if [ "$?" -ne 0 ]; then - echo "Must be called within a Git working tree." +git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { + echo "Error: Not inside a Git repository." >&2 exit 1 -fi - +} function bump_news_version { local version="$1" -- 2.47.3