@@ -325,8 +325,8 @@ if ($name) {
325
325
$version_file_backed_up = 0
326
326
# Force use of a backup if there are pending changes to $version_file
327
327
$version_file_force_backup = 0
328
- $has_no_tf_workspace = (tf workspaces | Select-String - pattern " No workspace" , " Unable to determine the workspace" )
329
- if (-not $has_no_tf_workspace ) {
328
+ $has_tf_workspace = (-not ( tf workspaces | Select-String - pattern " No workspace" , " Unable to determine the workspace" ) )
329
+ if ($has_tf_workspace ) {
330
330
if (-not (tf status $version_file / format:detailed | Select-String " There are no pending changes." )) {
331
331
Write-Output " $version_file has pending changes. Using backup instead of tf undo."
332
332
$version_file_force_backup = 1
@@ -436,7 +436,7 @@ if (-not $skipclean) {
436
436
437
437
$logdir = mkdir " $outdir \Logs" - Force
438
438
439
- if ($scorch -and ( -not $has_no_tf_workspace ) ) {
439
+ if ($scorch -and $has_tf_workspace ) {
440
440
tfpt scorch $buildroot / noprompt
441
441
}
442
442
@@ -445,7 +445,7 @@ $failed_logs = @()
445
445
Push-Location $buildroot
446
446
try {
447
447
$successful = $false
448
- if ((-not $version_file_force_backup ) -and ( -not $has_no_tf_workspace ) ) {
448
+ if ((-not $version_file_force_backup ) -and $has_tf_workspace ) {
449
449
tf edit $version_file | Out-Null
450
450
}
451
451
if ($version_file_force_backup -or -not $? ) {
@@ -639,7 +639,7 @@ try {
639
639
Set-ItemProperty $version_file - Name IsReadOnly - Value $true
640
640
}
641
641
Write-Output " Restored $version_file "
642
- } elseif ((-not $version_file_force_backup ) -and ( -not $has_no_tf_workspace ) ) {
642
+ } elseif ((-not $version_file_force_backup ) -and $has_tf_workspace ) {
643
643
tf undo / noprompt $version_file | Out-Null
644
644
}
645
645
0 commit comments