gpt-engineer-app[bot] commited on
Commit ·
8fa7bb6
1
Parent(s): b6753fb
Changes
Browse files
src/server/branch-debug.functions.ts
CHANGED
|
@@ -157,11 +157,14 @@ function parseDiff(diff: string): Hunk[] {
|
|
| 157 |
|
| 158 |
for (let i = 0; i < lines.length; i++) {
|
| 159 |
const line = lines[i];
|
| 160 |
-
const
|
| 161 |
-
if (
|
|
|
|
|
|
|
| 162 |
|
| 163 |
const hunkHeader = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@(.*)$/);
|
| 164 |
-
if (hunkHeader
|
|
|
|
| 165 |
const newStart = parseInt(hunkHeader[1], 10);
|
| 166 |
const newCount = parseInt(hunkHeader[2] ?? "1", 10);
|
| 167 |
const fnCtx = hunkHeader[3].trim() || null;
|
|
|
|
| 157 |
|
| 158 |
for (let i = 0; i < lines.length; i++) {
|
| 159 |
const line = lines[i];
|
| 160 |
+
const gitMatch = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
|
| 161 |
+
if (gitMatch) { currentFile = gitMatch[2]; continue; }
|
| 162 |
+
const plusFile = line.match(/^\+\+\+ (?:b\/)?(.+?)(?:\s|$)/);
|
| 163 |
+
if (plusFile && plusFile[1] !== "/dev/null") { currentFile = plusFile[1]; continue; }
|
| 164 |
|
| 165 |
const hunkHeader = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@(.*)$/);
|
| 166 |
+
if (hunkHeader) {
|
| 167 |
+
if (!currentFile) currentFile = "unknown";
|
| 168 |
const newStart = parseInt(hunkHeader[1], 10);
|
| 169 |
const newCount = parseInt(hunkHeader[2] ?? "1", 10);
|
| 170 |
const fnCtx = hunkHeader[3].trim() || null;
|