fix: remove revert-middle challenge

This commit is contained in:
Bjarke Sporring
2026-01-15 16:23:32 +01:00
parent 575e083f33
commit 0474a6de0e
3 changed files with 20 additions and 238 deletions

View File

@@ -4,9 +4,8 @@
Verifies the Module 06 challenge solutions.
.DESCRIPTION
Checks that all three revert scenarios have been completed correctly:
Checks that both revert scenarios have been completed correctly:
- regular-revert: Single commit reverted
- middle-revert: Commit in middle of history reverted
- multi-revert: Multiple commits reverted
#>
@@ -87,57 +86,9 @@ if ($LASTEXITCODE -ne 0) {
}
# ============================================================================
# SCENARIO 2: Middle Revert Verification
# SCENARIO 2: Multi Revert Verification
# ============================================================================
Write-Host "`n=== Scenario 2: Middle Revert ===" -ForegroundColor Cyan
git switch middle-revert 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Host "[FAIL] middle-revert branch not found" -ForegroundColor Red
$allChecksPassed = $false
} else {
# Check that a revert commit exists
$revertCommit = git log --oneline --grep="Revert" 2>$null
if ($revertCommit) {
Write-Host "[PASS] Revert commit found" -ForegroundColor Green
} else {
Write-Host "[FAIL] No revert commit found" -ForegroundColor Red
Write-Host "[HINT] Use: git revert <commit-hash>" -ForegroundColor Yellow
$allChecksPassed = $false
}
# Check that formatter.py is removed (reverted)
if (-not (Test-Path "formatter.py")) {
Write-Host "[PASS] Broken formatter.py successfully reverted (file removed)" -ForegroundColor Green
} else {
Write-Host "[FAIL] formatter.py still exists (should be reverted)" -ForegroundColor Red
Write-Host "[HINT] The bad commit should be reverted, removing formatter.py" -ForegroundColor Yellow
$allChecksPassed = $false
}
# Check that validation.py still exists (good commit before bad one)
if (Test-Path "validation.py") {
Write-Host "[PASS] validation.py preserved (good commit before bad one)" -ForegroundColor Green
} else {
Write-Host "[FAIL] validation.py missing (should still exist)" -ForegroundColor Red
$allChecksPassed = $false
}
# Check that config.py still exists (good commit after bad one)
if (Test-Path "config.py") {
Write-Host "[PASS] config.py preserved (good commit after bad one)" -ForegroundColor Green
} else {
Write-Host "[FAIL] config.py missing (should still exist)" -ForegroundColor Red
Write-Host "[HINT] Only revert the bad commit, not the good ones after it" -ForegroundColor Yellow
$allChecksPassed = $false
}
}
# ============================================================================
# SCENARIO 3: Multi Revert Verification
# ============================================================================
Write-Host "`n=== Scenario 3: Multi Revert ===" -ForegroundColor Cyan
Write-Host "`n=== Scenario 2: Multi Revert ===" -ForegroundColor Cyan
git switch multi-revert 2>&1 | Out-Null
@@ -209,9 +160,8 @@ if ($allChecksPassed) {
Write-Host "`nYou've mastered git revert!" -ForegroundColor Cyan
Write-Host "You now understand:" -ForegroundColor Cyan
Write-Host " ✓ Reverting commits safely without erasing history" -ForegroundColor White
Write-Host " ✓ Reverting old commits in the middle of history" -ForegroundColor White
Write-Host " ✓ Reverting multiple commits at once" -ForegroundColor White
Write-Host " ✓ Preserving commits before and after the reverted one" -ForegroundColor White
Write-Host " ✓ Preserving all other commits while undoing specific changes" -ForegroundColor White
Write-Host "`nReady for Module 07: Git Reset!" -ForegroundColor Green
Write-Host ""
exit 0