From e20f64ff1f2a1af2a9b26e2a5ccddc7d2bfb0f6c Mon Sep 17 00:00:00 2001 From: NINI Date: Mon, 5 Oct 2026 04:02:03 +0900 Subject: [PATCH] Record exact Git blob equality before restoring generated line endings --- tools/verify.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/verify.ps1 b/tools/verify.ps1 index 038d7f8..22cbf16 100644 --- a/tools/verify.ps1 +++ b/tools/verify.ps1 @@ -49,11 +49,16 @@ try { $record.apkMetadata = Join-Path $evidenceDir 'apk-metadata.json' # Unity rewrites these files with LF; restore only when Git proves their content is unchanged. $record.normalizedUnchangedSettings = @() + $record.settingsContentChecks = @() if (!$record.sourceDirty) { foreach ($settingsPath in @('ProjectSettings/GraphicsSettings.asset','ProjectSettings/ProjectAuditorSettings.asset','ProjectSettings/ProjectSettings.asset')) { - & git diff --quiet HEAD -- $settingsPath - if ($LASTEXITCODE -eq 0 -and [bool](& git status --porcelain -- $settingsPath)) { - & git restore --worktree -- $settingsPath + $workingBlob = & git hash-object --path=$settingsPath -- $settingsPath + $workingExit = $LASTEXITCODE + $sourceBlob = & git rev-parse "HEAD:$settingsPath" + $sourceExit = $LASTEXITCODE + $record.settingsContentChecks += @{ path=$settingsPath; workingBlob=$workingBlob; sourceBlob=$sourceBlob; hashObjectExit=$workingExit; revParseExit=$sourceExit } + if ($workingExit -eq 0 -and $sourceExit -eq 0 -and $workingBlob -eq $sourceBlob -and [bool](& git status --porcelain -- $settingsPath)) { + & git restore --source=HEAD --worktree -- $settingsPath if ($LASTEXITCODE -ne 0) { throw "Cannot restore unchanged generated setting: $settingsPath" } $record.normalizedUnchangedSettings += $settingsPath }