Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle empty lines in patch parser #6208

Merged
merged 1 commit into from
Jan 11, 2025
Merged

fix: Handle empty lines in patch parser #6208

merged 1 commit into from
Jan 11, 2025

Conversation

neubig
Copy link
Contributor

@neubig neubig commented Jan 11, 2025

This PR fixes an issue where the patch parser was not correctly handling empty lines in patches, causing patches to fail when trying to modify lines after an empty line.

The fix involves:

  1. Treating empty lines in the patch as context lines with empty content
  2. Adding a test case to verify the fix

Fixes #6140


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:479a7c7-nikolaik   --name openhands-app-479a7c7   docker.all-hands.dev/all-hands-ai/openhands:479a7c7

This fixes an issue where the patch parser was not correctly handling empty lines
in patches, causing patches to fail when trying to modify lines after an empty
line.

Fixes #6140
Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! It's worth trying this live ASAP, IMHO, since it's broken out there and this changes only the patch processing.

@neubig neubig merged commit 40c52fe into main Jan 11, 2025
14 checks passed
@neubig neubig deleted the fix-patch-empty-lines branch January 11, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants