From dd382f1bebf09d805fd9195e971e413eed689abb Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 20 Mar 2018 01:07:14 -0700 Subject: [PATCH] Visual Studio Projects: Assure commit id is correct when git hooks change When the git hooks have changed and git isn't in the path, the correct git commit id can't be determined and thus be available to be included in the build. This change announces that fact and stops a build. --- Visual Studio Projects/Pre-Build-Event.cmd | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Visual Studio Projects/Pre-Build-Event.cmd b/Visual Studio Projects/Pre-Build-Event.cmd index 34164617..c1071caa 100644 --- a/Visual Studio Projects/Pre-Build-Event.cmd +++ b/Visual Studio Projects/Pre-Build-Event.cmd @@ -252,7 +252,7 @@ fc /b ..\.git\hooks\post-commit git-hooks\post-commit >nul if %ERRORLEVEL% equ 0 goto _done_hooks echo ***************************************************** echo ***************************************************** -echo ** Installing updated git hooks repository ** +echo ** Installing updated git hooks in repository ** echo ***************************************************** echo ***************************************************** goto _install_hooks @@ -265,7 +265,19 @@ echo ***************************************************** :_install_hooks copy /y git-hooks\post* ..\.git\hooks\ call :WhereInPath git.exe > NUL 2>&1 -if %ERRORLEVEL% neq 0 goto _done_hooks +if %ERRORLEVEL% equ 0 goto _do_hooks +echo ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** +echo ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** +echo ** ** +echo ** Git Commit id invalid. You must perform a ** +echo ** git checkout on the current branch to solve ** +echo ** this problem. ** +echo ** ** +echo ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** +echo ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** +echo error: Review the Output Tab for more details. +exit 1 +:_do_hooks pushd .. git log -1 --pretty="SIM_GIT_COMMIT_ID %%H%%nSIM_GIT_COMMIT_TIME %%aI" >.git-commit-id popd