mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 22:48:03 +00:00
fix: show whitespace changes in edit tool diffs (#17213)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -162,4 +162,21 @@ describe('getDiffStat', () => {
|
||||
user_removed_chars: 0,
|
||||
});
|
||||
});
|
||||
it('should correctly report whitespace-only changes', () => {
|
||||
const fileName = 'test.py';
|
||||
const oldStr = 'def hello():\n print("world")';
|
||||
const aiStr = 'def hello():\n print("world")';
|
||||
const userStr = aiStr;
|
||||
const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
|
||||
expect(diffStat).toEqual({
|
||||
model_added_lines: 1,
|
||||
model_removed_lines: 1,
|
||||
model_added_chars: 18,
|
||||
model_removed_chars: 15,
|
||||
user_added_lines: 0,
|
||||
user_removed_lines: 0,
|
||||
user_added_chars: 0,
|
||||
user_removed_chars: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { DiffStat } from './tools.js';
|
||||
|
||||
export const DEFAULT_DIFF_OPTIONS: Diff.PatchOptions = {
|
||||
context: 3,
|
||||
ignoreWhitespace: true,
|
||||
ignoreWhitespace: false,
|
||||
};
|
||||
|
||||
export function getDiffStat(
|
||||
|
||||
@@ -136,7 +136,7 @@ describe('modifyWithEditor', () => {
|
||||
'Proposed',
|
||||
expect.objectContaining({
|
||||
context: 3,
|
||||
ignoreWhitespace: true,
|
||||
ignoreWhitespace: false,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -205,7 +205,7 @@ describe('modifyWithEditor', () => {
|
||||
'Proposed',
|
||||
expect.objectContaining({
|
||||
context: 3,
|
||||
ignoreWhitespace: true,
|
||||
ignoreWhitespace: false,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -233,7 +233,7 @@ describe('modifyWithEditor', () => {
|
||||
'Proposed',
|
||||
expect.objectContaining({
|
||||
context: 3,
|
||||
ignoreWhitespace: true,
|
||||
ignoreWhitespace: false,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user