Skip to content

Commit

Permalink
Specify safe.directory for git describe to get the version
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Jan 29, 2025
1 parent e20347e commit cfaf4c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endif()

find_program(GIT git)
if(GIT)
execute_process(COMMAND ${GIT} --git-dir=.git describe --tags --dirty --always
execute_process(COMMAND ${GIT} --git-dir=.git -c safe.directory='*' describe --tags --dirty --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PNGLDFLAGS := `${PKG_CONFIG} --libs-only-L libpng`
PNGLDLIBS := `${PKG_CONFIG} --libs-only-l libpng`

# Note: if this comes up empty, `version.cpp` will automatically fall back to last release number
VERSION_STRING := `git --git-dir=.git describe --tags --dirty --always 2>/dev/null`
VERSION_STRING := `git --git-dir=.git -c safe.directory='*' describe --tags --dirty --always 2>/dev/null`

WARNFLAGS := -Wall -pedantic -Wno-unknown-warning-option -Wno-gnu-zero-variadic-macro-arguments

Expand Down Expand Up @@ -265,4 +265,4 @@ wine-shim:

dist:
$Qgit ls-files | sed s~^~$${PWD##*/}/~ \
| tar -czf rgbds-`git describe --tags | cut -c 2-`.tar.gz -C .. -T -
| tar -czf rgbds-`git -c safe.directory='*' describe --tags | cut -c 2-`.tar.gz -C .. -T -
2 changes: 1 addition & 1 deletion test/asm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tryCmp () {
}

# Add the version constants test, outputting the closest tag to the HEAD
if git describe --tags --abbrev=0 >version.out; then
if git -c safe.directory='*' describe --tags --abbrev=0 >version.out; then
$RGBASM --version >>version.out
cat >version.asm <<EOF
IF !DEF(__RGBDS_RC__)
Expand Down

0 comments on commit cfaf4c2

Please sign in to comment.