From: Karel Zak Date: Wed, 19 Feb 2025 19:01:03 +0000 (+0100) Subject: tools: improve in-repo check X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eeab82e9d78339bbd75904ac3bfee51ee1025f04;p=thirdparty%2Futil-linux.git tools: improve in-repo check Signed-off-by: Karel Zak --- 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"