-
Notifications
You must be signed in to change notification settings - Fork 0
Fix file encoding support bom, latin1, Windows files #2
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,33 @@ | ||
name: Bug Report | ||
description: Report a bug or unexpected behavior | ||
title: "[Bug]: " | ||
labels: ["bug"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for reporting an issue! Please fill out the sections below. | ||
|
||
- type: textarea | ||
id: description | ||
attributes: | ||
label: Description | ||
description: A clear description of what the bug is. | ||
placeholder: Tell us what happened | ||
description: What happened? | ||
placeholder: Describe the issue | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
id: reproduction | ||
attributes: | ||
label: Steps to Reproduce | ||
description: Steps to reproduce the behavior | ||
placeholder: | | ||
1. Load diff with `load_diff("path/to/file.diff")` | ||
2. Run `list_chunks()` | ||
3. See error | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
id: expected | ||
attributes: | ||
label: Expected Behavior | ||
description: What you expected to happen | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
id: environment | ||
attributes: | ||
label: Environment | ||
description: Your environment details | ||
value: | | ||
- OS: [e.g., Windows 11, macOS 14, Ubuntu 22.04] | ||
- Python version: [e.g., 3.10.12] | ||
- diffchunk version: [e.g., 0.1.0] | ||
- MCP client: [e.g., Claude Desktop] | ||
validations: | ||
required: true | ||
placeholder: OS, Python version, diffchunk version, etc. | ||
|
||
- type: textarea | ||
id: additional | ||
attributes: | ||
label: Additional Context | ||
description: Any other context, screenshots, or files related to the problem | ||
description: Screenshots, logs, or other relevant information |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,6 @@ Thumbs.db | |
*.patch | ||
!tests/test_data/*.diff | ||
test_output/ | ||
|
||
# example repos folders for diffs | ||
repos/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
diff --git a/file1.txt b/file1.txt | ||
index 1234567..abcdefg 100644 | ||
--- a/file1.txt | ||
+++ b/file1.txt | ||
@@ -1,2 +1,2 @@ | ||
line 1 | ||
-old line | ||
+new line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
diff --git a/fil�.txt b/fil�.txt | ||
index 1234567..abcdefg 100644 | ||
--- a/fil�.txt | ||
+++ b/fil�.txt | ||
@@ -1,2 +1,2 @@ | ||
line 1 | ||
-old lin� | ||
+new lin� |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
diff --git a/file1.txt b/file1.txt | ||
index 1234567..abcdefg 100644 | ||
--- a/file1.txt | ||
+++ b/file1.txt | ||
@@ -1,2 +1,2 @@ | ||
line 1 | ||
-old line | ||
+new line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
diff --git a/file1.txt b/file1.txt | ||
index 1234567..abcdefg 100644 | ||
--- a/file1.txt | ||
+++ b/file1.txt | ||
@@ -1,2 +1,2 @@ | ||
line 1 | ||
-old line | ||
+new line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Test to reproduce Windows "No valid diff content found" issue.""" | ||
|
||
import pytest | ||
from pathlib import Path | ||
|
||
from src.tools import DiffChunkTools | ||
|
||
|
||
class TestWindowsEncoding: | ||
"""Test Windows encoding issues that cause 'No valid diff content found'.""" | ||
|
||
@pytest.fixture | ||
def test_data_dir(self): | ||
return Path(__file__).parent / "test_data" | ||
|
||
@pytest.fixture | ||
def tools(self): | ||
return DiffChunkTools() | ||
|
||
def test_encoding_scenarios_work_with_fix(self, tools, test_data_dir): | ||
"""Test that encoding scenarios work with the fix.""" | ||
working_files = [ | ||
"minimal_working.diff", # UTF-8 baseline | ||
"minimal_windows.diff", # Windows \r\n line endings | ||
"minimal_bom.diff", # UTF-8 BOM (now handled) | ||
"minimal_latin1.diff", # Latin-1 encoding (now handled) | ||
] | ||
|
||
for filename in working_files: | ||
result = tools.load_diff( | ||
str(test_data_dir / filename), max_chunk_lines=1000 | ||
) | ||
assert result["chunks"] > 0, f"{filename} should work with fix" | ||
assert result["files"] > 0, f"{filename} should have files" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.