Fix: protected files skip entirely before stale token check
Protected files (like updates.xml) were being overwritten because the stale-token check ran AFTER the canOverwrite gate. Now protected files continue (skip) immediately, even with --force. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -598,7 +598,12 @@ HCL;
|
||||
$isReadme = $basename === 'readme.md';
|
||||
$isChangelog = in_array($basename, ['changelog.md', 'changelog'], true);
|
||||
$isProtected = $isReadme || $isChangelog;
|
||||
$canOverwrite = !$isProtected && ($force || $entry['always_overwrite']) && !($entry['protected'] ?? false);
|
||||
// Protected files are NEVER overwritten, even with --force
|
||||
if ($entry['protected'] ?? false) {
|
||||
$summary['skipped'][] = ['file' => $targetPath, 'reason' => 'Protected — never overwritten'];
|
||||
continue;
|
||||
}
|
||||
$canOverwrite = !$isProtected && ($force || $entry['always_overwrite']);
|
||||
|
||||
if ($isReadme) {
|
||||
$summary['skipped'][] = ['file' => $targetPath, 'reason' => 'README — never overwritten'];
|
||||
|
||||
Reference in New Issue
Block a user