diff options
| author | sigoden <sigoden@gmail.com> | 2024-11-29 20:18:33 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-29 20:18:33 +0800 |
| commit | c4ba6ff379bdce768f6053671309e2e2f4a6fc79 (patch) | |
| tree | 57af0bf5b49617d98024a3af394ec395e528a111 /utils/patch.awk | |
| parent | 139bd5a3f6738b1d478ffcca497ba09262f443b2 (diff) | |
| download | llm-functions-docker-c4ba6ff379bdce768f6053671309e2e2f4a6fc79.tar.gz | |
refactor: improve coder agent (#131)
Diffstat (limited to 'utils/patch.awk')
| -rwxr-xr-x | utils/patch.awk | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/patch.awk b/utils/patch.awk index b651fb2..79deec2 100755 --- a/utils/patch.awk +++ b/utils/patch.awk @@ -35,7 +35,7 @@ END { } if (mode == "hunk") { - while (patchLineIndex <= totalPatchLines && line ~ /^[-+ ]/ && line !~ /^--- /) { + while (patchLineIndex <= totalPatchLines && line ~ /^[-+ ]|^\s*$/ && line !~ /^--- /) { sanitizedLine = substr(line, 2) if (line !~ /^\+/) { hunkTotalOriginalLines[hunkIndex]++; @@ -68,7 +68,7 @@ END { line = lines[lineIndex] nextLineIndex = 0 - if (line == hunkOriginalLines[hunkIndex,1]) { + if (hunkIndex <= totalHunks && line == hunkOriginalLines[hunkIndex,1]) { nextLineIndex = lineIndex + 1 for (i = 2; i <= hunkTotalOriginalLines[hunkIndex]; i++) { if (lines[nextLineIndex] != hunkOriginalLines[hunkIndex,i]) { @@ -83,7 +83,7 @@ END { print hunkUpdatedLines[hunkIndex,i] } hunkIndex++ - lineIndex = nextLineIndex -1; + lineIndex = nextLineIndex - 1; } else { print line } |
