Skip to content

GetGitRevisionDescription fails on new repository (before push) #54

@sbusch42

Description

@sbusch42

When trying to build a project in a new git repository, before the first push, some git directories are not yet set up and the GetGitRevisionDescription.cmake script fails. The script should check if directories exist before trying to access them.

CMake Error: File /workspace/projects/cginternals/cppfs/.git/packed-refs does not exist.

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:27 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:28 (file):
file failed to open for reading (No such file or directory):
/workspace/projects/cginternals/cppfs/build/CMakeFiles/git-data/packed-refs
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:39 (file):
file failed to open for reading (No such file or directory):
/workspace/projects/cginternals/cppfs/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions