fix: cherry-pick conflict

This commit is contained in:
Bjarke Sporring
2026-01-15 15:20:32 +01:00
parent 988ce3bc92
commit 1c20a06c21
2 changed files with 32 additions and 34 deletions

View File

@@ -128,40 +128,29 @@ git add app.py
git commit -m "Add beta features framework" | Out-Null
# Commit 4: Performance bug fix (SHOULD be cherry-picked)
$appWithPerformance = @"
class App:
# This commit adds caching to the existing file to fix performance
# It should apply cleanly to main since it doesn't depend on experimental features
$performanceCode = @"
class DataCache:
def __init__(self):
self.version = '1.0.0'
self.experimental_mode = False
self.beta_features = []
self.cache = {}
def start(self):
print('App started')
if self.experimental_mode:
self.enable_experimental_features()
def enable_experimental_features(self):
print('Experimental features enabled')
def add_beta_feature(self, feature):
self.beta_features.append(feature)
def get_data(self, key):
def get(self, key):
# Use cache to improve performance
if key in self.cache:
return self.cache[key]
data = self.fetch_data(key)
self.cache[key] = data
return data
return None
def fetch_data(self, key):
# Simulate data fetching
return {'key': key, 'value': 'data'}
def set(self, key, value):
self.cache[key] = value
def clear(self):
self.cache.clear()
"@
Set-Content -Path "app.py" -Value $appWithPerformance
git add app.py
Set-Content -Path "cache.py" -Value $performanceCode
git add cache.py
git commit -m "Fix performance issue with data caching" | Out-Null
# Return to module directory

View File

@@ -77,7 +77,7 @@ if ($mainCommitCount -ne 4) {
} else {
Write-Host "Hint: You should cherry-pick ONLY the 2 bug fix commits, not all commits" -ForegroundColor Yellow
}
Write-Host "`nExpected commits on $mainBranch:" -ForegroundColor Yellow
Write-Host "`nExpected commits on ${mainBranch}:" -ForegroundColor Yellow
Write-Host " 1. Initial app implementation" -ForegroundColor White
Write-Host " 2. Add README" -ForegroundColor White
Write-Host " 3. Fix security vulnerability in input validation (cherry-picked)" -ForegroundColor White
@@ -125,23 +125,32 @@ if (-not (Test-Path "app.py")) {
exit 1
}
# Check that app.py has the performance fix (cache) but NOT experimental features
$appContent = Get-Content "app.py" -Raw
# Should have cache (from performance fix)
if ($appContent -notmatch "cache") {
Write-Host "[FAIL] app.py is missing the performance fix (cache)." -ForegroundColor Red
# Check that cache.py exists (from performance fix)
if (-not (Test-Path "cache.py")) {
Write-Host "[FAIL] cache.py not found on $mainBranch branch." -ForegroundColor Red
Write-Host "Hint: You need to cherry-pick the 'Fix performance issue' commit" -ForegroundColor Yellow
Set-Location ..
exit 1
}
if ($appContent -notmatch "get_data") {
Write-Host "[FAIL] app.py is missing the get_data method from performance fix." -ForegroundColor Red
# Check that cache.py has the DataCache class
$cacheContent = Get-Content "cache.py" -Raw
if ($cacheContent -notmatch "DataCache") {
Write-Host "[FAIL] cache.py is missing the DataCache class." -ForegroundColor Red
Set-Location ..
exit 1
}
if ($cacheContent -notmatch "def get\(") {
Write-Host "[FAIL] cache.py is missing the get method." -ForegroundColor Red
Set-Location ..
exit 1
}
# Check that app.py does NOT have experimental features
$appContent = Get-Content "app.py" -Raw
# Should NOT have experimental features
if ($appContent -match "experimental_mode") {
Write-Host "[FAIL] app.py contains experimental features (experimental_mode)." -ForegroundColor Red