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,10 +4,9 @@
Sets up the Module 06 challenge environment for learning git revert.
.DESCRIPTION
This script creates a challenge directory with three branches demonstrating
This script creates a challenge directory with two branches demonstrating
different revert scenarios:
- regular-revert: Basic revert of a single bad commit at the end
- middle-revert: Reverting a bad commit in the middle of history
- regular-revert: Basic revert of a single bad commit
- multi-revert: Reverting multiple commits at once
#>
@@ -104,68 +103,9 @@ git commit -m "Add modulo function" | Out-Null
Write-Host "[CREATED] regular-revert branch with bad divide commit" -ForegroundColor Green
# ============================================================================
# SCENARIO 2: Revert in Middle of History
# SCENARIO 2: Multi Revert (Multiple Bad Commits)
# ============================================================================
Write-Host "`nScenario 2: Creating middle-revert scenario..." -ForegroundColor Cyan
# Switch back to main
git switch $mainBranch | Out-Null
# Create middle-revert branch
git switch -c middle-revert | Out-Null
# Good commit: Add validation module
$validationContent = @"
# validation.py - Input validation
def validate_number(value):
"""Check if value is a valid number."""
try:
float(value)
return True
except ValueError:
return False
"@
Set-Content -Path "validation.py" -Value $validationContent
git add .
git commit -m "Add input validation module" | Out-Null
# BAD commit: Add broken formatter
$formatterContent = @"
# formatter.py - Output formatting
def format_result(result):
"""BROKEN: Doesn't handle None or errors properly!"""
return f"Result: {result.upper()}" # This crashes if result is not a string!
"@
Set-Content -Path "formatter.py" -Value $formatterContent
git add .
git commit -m "Add broken formatter - needs to be reverted!" | Out-Null
# Good commit: Add configuration (depends on validation, not formatter)
$configContent = @"
# config.py - Application configuration
from validation import validate_number
DEFAULT_PRECISION = 2
def set_precision(value):
"""Set calculation precision."""
if validate_number(value):
return int(value)
return DEFAULT_PRECISION
"@
Set-Content -Path "config.py" -Value $configContent
git add .
git commit -m "Add configuration module" | Out-Null
Write-Host "[CREATED] middle-revert branch with bad commit in the middle" -ForegroundColor Green
# ============================================================================
# SCENARIO 3: Multi Revert (Multiple Bad Commits)
# ============================================================================
Write-Host "`nScenario 3: Creating multi-revert branch..." -ForegroundColor Cyan
Write-Host "`nScenario 2: Creating multi-revert branch..." -ForegroundColor Cyan
# Switch back to main
git switch $mainBranch | Out-Null
@@ -247,10 +187,9 @@ git switch regular-revert | Out-Null
Set-Location ..
Write-Host "`n=== Setup Complete! ===" -ForegroundColor Green
Write-Host "`nThree revert scenarios have been created:" -ForegroundColor Cyan
Write-Host " 1. regular-revert - Revert a bad commit at the end" -ForegroundColor White
Write-Host " 2. middle-revert - Revert a bad commit in the middle of history" -ForegroundColor White
Write-Host " 3. multi-revert - Revert multiple bad commits" -ForegroundColor White
Write-Host "`nTwo revert scenarios have been created:" -ForegroundColor Cyan
Write-Host " 1. regular-revert - Revert a single bad commit" -ForegroundColor White
Write-Host " 2. multi-revert - Revert multiple bad commits" -ForegroundColor White
Write-Host "`nYou are currently on the 'regular-revert' branch." -ForegroundColor Cyan
Write-Host "`nNext steps:" -ForegroundColor Cyan
Write-Host " 1. cd challenge" -ForegroundColor White