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
{{ message }}
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
letmut instructions = String::from("This file provides a guide to understanding the diff output generated by RepoDiff, a simplified and context-aware unified diff designed for code reviews.
138
+
RepoDiff processes a single `git diff` output and applies user-defined rules to tailor the content, with special handling for C# files.
139
139
140
-
**1. Basic Structure:**
140
+
# 1. Basic Structure:
141
141
142
142
A Git diff file describes the *differences* between two versions of a file. It's structured into *hunks*, which represent contiguous regions of change.
143
143
144
-
* `diff --git a/<path> b/<path>`: Indicates the file being compared. `a/` refers to the "old" version, and `b/` refers to the "new" version. (Note that paths always use forward slashes in Git diff output, even on Windows systems.)
144
+
* `diff --git a/<path> b/<path>`: Indicates the file being compared. `a/` refers to the \"old\" version, and `b/` refers to the \"new\" version. (Note that paths always use forward slashes in Git diff output, even on Windows systems.)
145
145
* `--- a/<path>`: Marks the beginning of the original file content.
146
146
* `+++ b/<path>`: Marks the beginning of the modified file content.
147
147
* `@@ -<start_line_old>,<num_lines_old> +<start_line_new>,<num_lines_new> @@ <section_header>`: This is the *hunk header*. (Optional in simplified output, but common in real diffs).
@@ -153,49 +153,64 @@ A Git diff file describes the *differences* between two versions of a file. It's
153
153
* `-`: Line removed from the old version.
154
154
* `+`: Line added to the new version.
155
155
156
-
**2. Simplified Example:**
156
+
## Simplified Example:
157
157
158
-
```
158
+
```diff
159
159
diff --git a/MyFile.cs b/MyFile.cs
160
160
--- a/MyFile.cs
161
161
+++ b/MyFile.cs
162
162
// Some code
163
-
string oldValue = "old";
163
+
string oldValue = \"old\";
164
164
-// Removed line
165
-
+string newValue = "new";
165
+
+string newValue = \"new\";
166
166
// More code
167
167
```
168
168
169
169
**Explanation of the Example:**
170
-
171
170
* The file being changed is `MyFile.cs`.
172
-
* `" string oldValue = "old";"`: This line is present in both versions.
171
+
* `\" string oldValue = \"old\";\"`: This line is present in both versions.
173
172
* `-// Removed line`: This line was removed from the old version.
174
-
* `+string newValue = "new";`: This line was added to the new version.
175
-
* `" // More code"`: This line is present in both versions.
173
+
* `+string newValue = \"new\";`: This line was added to the new version.
174
+
* `\" // More code\"`: This line is present in both versions.
176
175
177
-
**3. Key LLM Considerations:**
176
+
# 2. Special Handling in RepoDiff
178
177
179
-
* **Focus on Content Lines:** The most important part for understanding changes is the content prefixed with ` `, `-`, or `+`.
180
-
* **Context is Crucial:** Use the surrounding unchanged lines to understand the *purpose* of the change.
181
-
* **File Paths:** Pay attention to the file paths (`a/<path>`, `b/<path>`) to understand which files are being modified.
178
+
RepoDiff customizes the diff output using user-defined filters, with enhanced control for C# files (*.cs).
182
179
183
-
**4. Application to your File:**
180
+
The following JSON filters are applied to the diff output:
184
181
185
-
* **".cs" Files:** Changes to C# source code. Focus on the addition (`+`) and removal (`-`) of code lines to understand logic changes.
186
-
* **"Test*.cs" Files:** Changes to unit test files. These are often important for understanding how the functionality is being tested and whether the changes are robust.
187
-
* **".xml" Files:** Changes to configuration or data files. Look for added, removed, or modified XML elements and attributes. Focus is usually on changes to properties.
182
+
");
183
+
184
+
ifletSome(filters) = filters_json {
185
+
instructions.push_str(filters);
186
+
}
187
+
188
+
instructions.push_str("
189
+
190
+
Each filter defines:
188
191
189
-
**5. Special Instructions for File Types based on the given filters:**
192
+
* *`file_pattern`*: A glob pattern matching file names (e.g., \"*.cs\" for C# files).
193
+
* *`context_lines`*: Number of unchanged lines shown before and after each change or hunk.
194
+
* **For C# files only:**
195
+
* *`include_method_body`*: If true, includes the entire body of methods with changes.
196
+
* *`include_signatures`*: If true, includes signatures of methods within the context range of changes, with partial or full bodies based on size. It will always include namespace/class declarations enclosing changed methods. The placeholder `⋮----`* is used to omit code inside the hunk that is outside of the context range
190
197
191
-
* `.cs` code is assumed to not contain test code
192
-
* `*Test*.cs` contain test code, which should be helpful for understanding functionality.
193
-
* `*.xml` contains configuration.
198
+
# 4. Usage Guidelines
199
+
200
+
* Focus on Content: Lines with ` `, `-`, or `+` show the actual changes.
201
+
* Use Context: Unchanged lines provide purpose and structure.
202
+
* Interpret Placeholders: `⋮----` signals omitted code; infer its presence simplifies analysis. Consider the context around the placeholder to understand what might have been omitted (e.g., method body, part of a method, etc.).
203
+
* File Paths: Track `a/<path>` and `b/<path>` to identify modified files.
204
+
* C# Specifics: Note method bodies and signatures in *.cs files are tailored by filters.
194
205
195
206
By focusing on these key elements, you can effectively extract meaningful information from Git diff output and summarize the changes made in a software project.
0 commit comments