This fixes #24373. Having the git status information available in the CMake logs will make it easier to troubleshoot build failure reports.