From 1cb364d8cfdf1abadac03c900ddd30de0291426d Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Fri, 16 Sep 2022 13:59:21 +0200 Subject: [PATCH] Make sure git doesn't try to get version from other repository Fixes https://github.com/xiph/flac/issues/443 --- CMakeLists.txt | 6 +++--- Makefile.am | 2 -- configure.ac | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b43578f..73a36cc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Makefile.am b/Makefile.am index ae8cb006..7c924c2c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,6 +63,4 @@ EXTRA_DIST = \ ltmain.sh \ strip_non_asm_libtool_args.sh -DISTCHECK_CONFIGURE_FLAGS = '--disable-version-from-git' - CLEANFILES = *~ diff --git a/configure.ac b/configure.ac index c771dfdc..5fa8d9db 100644 --- a/configure.ac +++ b/configure.ac @@ -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