Make sure git doesn't try to get version from other repository

Fixes https://github.com/xiph/flac/issues/443
This commit is contained in:
Martijn van Beurden 2022-09-16 13:59:21 +02:00 committed by GitHub
parent 1a84604b2b
commit 1cb364d8cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -55,21 +55,21 @@ find_program (HAVE_GIT git)
if(HAVE_GIT)
execute_process(
COMMAND git describe --tags --exact-match
COMMAND git --git-dir=.git describe --tags --exact-match
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND git log -1 --pretty=format:%h
COMMAND git --git-dir=.git log -1 --pretty=format:%h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND git log -1 --pretty=format:%cd --date=format:%Y%m%d
COMMAND git --git-dir=.git log -1 --pretty=format:%cd --date=format:%Y%m%d
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE

View File

@ -63,6 +63,4 @@ EXTRA_DIST = \
ltmain.sh \
strip_non_asm_libtool_args.sh
DISTCHECK_CONFIGURE_FLAGS = '--disable-version-from-git'
CLEANFILES = *~

View File

@ -593,9 +593,9 @@ dnl for correct FLAC_API
AC_CHECK_PROG(GIT_FOUND,git,yes)
if test x$GIT_FOUND$enable_version_from_git = "xyesyes"; then
GIT_COMMIT_TAG=`git -C $srcdir describe --tags --exact-match 2>/dev/null`
GIT_COMMIT_HASH=`git -C $srcdir log -1 --pretty=format:%h 2>/dev/null`
GIT_COMMIT_DATE=`git -C $srcdir log -1 --pretty=format:%cd --date=format:%Y%m%d 2>/dev/null`
GIT_COMMIT_TAG=`git -C $srcdir --git-dir=.git describe --tags --exact-match 2>/dev/null`
GIT_COMMIT_HASH=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%h 2>/dev/null`
GIT_COMMIT_DATE=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%cd --date=format:%Y%m%d 2>/dev/null`
if test ${#GIT_COMMIT_HASH} = 8 && test ${#GIT_COMMIT_DATE} = 8; then
GIT_COMMIT_VERSION_AVAIL=yes
if test ${#GIT_COMMIT_TAG} != 0 ; then