2022-07-07 19:38:44 +02:00
|
|
|
|
$commit = try { git rev-parse HEAD } catch { "unknown" }
|
|
|
|
|
try { git diff-index --quiet HEAD } catch {}
|
|
|
|
|
$dirty = if ($LASTEXITCODE) { "true" } else { "false" }
|
2018-12-31 20:04:05 +01:00
|
|
|
|
echo "#pragma once`r`n#define GIT_COMMIT `"$commit`"`r`n#define GIT_DIRTY $dirty" | out-file -encoding ASCII auto/git_info.h.new
|
|
|
|
|
if (-not (Test-Path .\auto\git_info.h) -or (Compare-Object $(Get-Content .\auto\git_info.h.new) $(Get-Content .\auto\git_info.h))) {
|
|
|
|
|
mv -Force auto/git_info.h.new auto/git_info.h
|
|
|
|
|
} else {
|
|
|
|
|
rm auto/git_info.h.new
|
|
|
|
|
}
|