未验证 提交 13317a96 编写于 作者: A Alexandru Dima 提交者: GitHub

Merge pull request #113618 from shskwmt/113318-diff-empty-files

Fixes #113318: Show having no change  when diffing two empty files
......@@ -313,6 +313,13 @@ export class DiffComputer {
if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {
// empty original => fast path
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
return {
quitEarly: false,
changes: []
};
}
return {
quitEarly: false,
changes: [{
......
......@@ -462,6 +462,13 @@ suite('Editor Diff - DiffComputer', () => {
assertDiff(original, modified, expected, true, false, true);
});
test('empty diff 5', () => {
let original = [''];
let modified = [''];
let expected: ILineChange[] = [];
assertDiff(original, modified, expected, true, false, true);
});
test('pretty diff 1', () => {
let original = [
'suite(function () {',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册