This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch improve-in-release-check in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 11d59cc33969b487b5fe3d2bbd3c412b142ebe04 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Thu Mar 12 22:56:58 2026 -0400 Use a more reliable "in release" checking method When we run configure and make we differentiate if we're in a release or running in dev mode. Previously, we checked for .git directory, but there is supposedly a better way -- `git rev-parse --is-inside-work-tree`. This may help in cases when .git is not a directory but a reference file with a `gitdir: $path` in it. [1] https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---is-inside-work-tree [2] Also you can have a plain text file .git at the root of your working tree, containing gitdir: <path> to point at the real directory that has the repository --- Makefile | 2 +- configure | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 17c3c94c3..7672fa095 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ GRADLE?=$(CURDIR)/extra/nouveau/gradlew COUCHDB_GIT_SHA=$(git_sha) -IN_RELEASE = $(shell if [ ! -d .git ]; then echo true; fi) +IN_RELEASE = $(shell if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then echo true; fi) ifeq ($(IN_RELEASE), true) # 1. Building from tarball, use version.mk. diff --git a/configure b/configure index 819953da4..a9c1f16ec 100755 --- a/configure +++ b/configure @@ -39,6 +39,11 @@ run_erlang() { erl -noshell -eval "$1" -eval "halt()." } +# Check if we're inside a git repo. This is used to check if we're in a release +is_git_checkout() { + git rev-parse --is-inside-work-tree > /dev/null 2>&1 +} + COUCHDB_USER="$(whoami 2>/dev/null || echo couchdb)" JS_ENGINE=${JS_ENGINE:-"spidermonkey"} SM_VSN=${SM_VSN:-"128"} @@ -350,12 +355,12 @@ if [ "${WITH_SPIDERMONKEY}" = "false" ] && [ "${JS_ENGINE}" = "spidermonkey" ]; fi # If we're in a release tarball and we don't have proper, then mark it as skipped -if [ ! -d .git ] && [ "$WITH_PROPER" = "true" ] && [ ! -d src/proper ]; then +if [ ! is_git_checkout ] && [ "$WITH_PROPER" = "true" ] && [ ! -d src/proper ]; then WITH_PROPER="false" fi # If we're in a release tarball and we don't have spidermonkey, then mark it as skipped and enable quickjs -if [ ! -d .git ] && [ "$WITH_SPIDERMONKEY" = "true" ] && [ ! -d src/couch/priv/couch_js ]; then +if [ ! is_git_checkout ] && [ "$WITH_SPIDERMONKEY" = "true" ] && [ ! -d src/couch/priv/couch_js ]; then echo "NOTICE: Spidermonkey was disabled in release tarball. Setting JS_ENGINE=quickjs" WITH_SPIDERMONKEY="false" JS_ENGINE="quickjs" @@ -562,7 +567,7 @@ if [ "$WITH_CLOUSEAU" = "true" ]; then fi # only update dependencies, when we are not in a release tarball -if [ -d .git ] && [ "$SKIP_DEPS" = "false" ]; then +if [ is_git_checkout ] && [ "$SKIP_DEPS" = "false" ]; then echo "==> updating dependencies" ${REBAR} get-deps update-deps fi
