You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate a unified diff similar to what "diff -U0" would produce.
113
+
Generate a unified diff that can be cleanly applied to modify code files.
114
114
115
-
The first two lines must include the file paths, starting with "---" for the original file and "+++" for the updated file. Do not include timestamps with the file paths.
115
+
## Step-by-Step Instructions:
116
116
117
-
Each hunk of changes must start with a line containing only "@@ ... @@". Do not include line numbers or ranges in the "@@ ... @@" lines. These are not necessary for the user's patch tool.
117
+
1. Start with file headers:
118
+
- First line: "--- {original_file_path}"
119
+
- Second line: "+++ {new_file_path}"
118
120
119
-
Your output must be a correct, clean patch that applies successfully against the current file contents. Mark all lines that need to be removed or changed with "-". Mark all new or modified lines with "+". Ensure you include all necessary changes; missing or unmarked lines will result in a broken patch.
121
+
2. For each change section:
122
+
- Begin with "@@ ... @@" separator line without line numbers
123
+
- Include 2-3 lines of context before and after changes
124
+
- Mark removed lines with "-"
125
+
- Mark added lines with "+"
126
+
- Preserve exact indentation
120
127
121
-
Indentation matters! Make sure to preserve the exact indentation of both removed and added lines.
128
+
3. Group related changes:
129
+
- Keep related modifications in the same hunk
130
+
- Start new hunks for logically separate changes
131
+
- When modifying functions/methods, include the entire block
122
132
123
-
Start a new hunk for each section of the file that requires changes. However, include only the hunks that contain actual changes. If a hunk consists entirely of unchanged lines, skip it.
133
+
## Requirements:
124
134
125
-
Group related changes together in the same hunk whenever possible. Output hunks in whatever logical order makes the most sense.
135
+
1. MUST include exact indentation
136
+
2. MUST include sufficient context for unique matching
137
+
3. MUST group related changes together
138
+
4. MUST use proper unified diff format
139
+
5. MUST NOT include timestamps in file headers
140
+
6. MUST NOT include line numbers in the @@ header
126
141
127
-
When editing a function, method, loop, or similar code block, replace the *entire* block in one hunk. Use "-" lines to delete the existing block and "+" lines to add the updated block. This ensures accuracy in your diffs.
128
-
129
-
If you need to move code within a file, create two hunks: one to delete the code from its original location and another to insert it at the new location.
130
-
131
-
To create a new file, show a diff from "--- /dev/null" to "+++ path/to/new/file.ext".
0 commit comments