From bf0fb34df49b35f5703db3249500809670e31bbd Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:02:30 +0200 Subject: [PATCH] Git - fix unstage selected ranges command (#247770) --- extensions/git/src/commands.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 6aec2846e63..d2dc4ec6586 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -2018,6 +2018,8 @@ export class CommandCenter { d.originalEndLineNumber === c.originalEndLineNumber && d.modifiedStartLineNumber === c.modifiedStartLineNumber && d.modifiedEndLineNumber === c.modifiedEndLineNumber)); + + this.logger.trace(`[CommandCenter][unstageSelectedRanges] changes: ${JSON.stringify(changes)}`); await this._unstageChanges(textEditor, changes); return; } @@ -2076,9 +2078,7 @@ export class CommandCenter { const originalUri = toGitUri(modifiedUri, 'HEAD'); const originalDocument = await workspace.openTextDocument(originalUri); - - const invertedChanges = changes.map(invertLineChange); - const result = applyLineChanges(originalDocument, modifiedDocument, invertedChanges); + const result = applyLineChanges(originalDocument, modifiedDocument, changes); await this.runByRepository(modifiedUri, async (repository, resource) => await repository.stage(resource, result, modifiedDocument.encoding));