From a0c88b22627dd6c3ceb68e06285ac5f454ca3e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 30 Oct 2024 08:09:33 +0100 Subject: [PATCH] Fix check of WeeChat Relay git repository The `.git` directory can also be a regular file in a git worktree. --- tools/build_debian.sh | 2 +- tools/makedist.sh | 2 +- tools/set_git_version.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/build_debian.sh b/tools/build_debian.sh index d352dc0..1dfa8a0 100755 --- a/tools/build_debian.sh +++ b/tools/build_debian.sh @@ -134,7 +134,7 @@ fi # check git repository root_dir=$(git rev-parse --show-toplevel) -if [ -z "${root_dir}" ] || [ ! -d "${root_dir}/.git" ] || [ ! -d "${root_dir}/debian-stable" ]; then +if [ -z "${root_dir}" ] || [ ! -e "${root_dir}/.git" ] || [ ! -d "${root_dir}/debian-stable" ]; then error "this script must be run from WeeChat Relay git repository." fi cd "${root_dir}" diff --git a/tools/makedist.sh b/tools/makedist.sh index f6a1a18..fa1f075 100755 --- a/tools/makedist.sh +++ b/tools/makedist.sh @@ -35,7 +35,7 @@ # check git repository root_dir=$(git rev-parse --show-toplevel) -if [ -z "${root_dir}" ] || [ ! -d "${root_dir}/.git" ]; then +if [ -z "${root_dir}" ] || [ ! -e "${root_dir}/.git" ]; then echo "This script must be run from WeeChat Relay git repository." exit 1 fi diff --git a/tools/set_git_version.sh b/tools/set_git_version.sh index abf9484..ba0a12c 100755 --- a/tools/set_git_version.sh +++ b/tools/set_git_version.sh @@ -43,7 +43,7 @@ git_version="" case ${version} in *-*) # devel/rc version (like 1.0.0-dev or 1.0.0-rc1) - if [ -d "${root_dir}/.git" ]; then + if [ -e "${root_dir}/.git" ]; then git_version=$(cd "${root_dir}" && git describe 2>/dev/null) fi if [ -z "${git_version}" ]; then