This commit is contained in:
@@ -115,6 +115,13 @@ class GitWorkspace:
|
||||
deleted += int(remove) if remove.isdigit() else 0
|
||||
return ChangeSummary(tuple(files), added, deleted)
|
||||
|
||||
def diff(self, limit: int = 12_000) -> str:
|
||||
output = self._git("diff", "--no-ext-diff", "--unified=3").stdout
|
||||
if len(output) <= limit:
|
||||
return output
|
||||
half = limit // 2
|
||||
return output[:half] + "\n...[diff middle omitted]...\n" + output[-half:]
|
||||
|
||||
def commit(self, report_id: int) -> str:
|
||||
self._git("add", "--all")
|
||||
self._git("commit", "-m", f"Fix failure report #{report_id}")
|
||||
|
||||
@@ -120,6 +120,7 @@ class AutomationWorker:
|
||||
report.id,
|
||||
attempt,
|
||||
)
|
||||
discarded_diff = workspace.diff()
|
||||
workspace.restore_checkpoint(valid_checkpoint)
|
||||
restored_state = (
|
||||
"The last syntax-valid changes were restored. Correct them without recreating "
|
||||
@@ -131,7 +132,8 @@ class AutomationWorker:
|
||||
report,
|
||||
RuntimeError(
|
||||
f"{exception}\n{restored_state} Make smaller edits and run php -l on each "
|
||||
"changed PHP file."
|
||||
"changed PHP file. Reconstruct the intended application fix from this discarded "
|
||||
f"patch excerpt, correcting its syntax:\n{discarded_diff}"
|
||||
),
|
||||
)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user