From 3a54676f500a9e8c86770d80aad3d75f50c1ae1b Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 6 Jul 2018 14:53:13 +0200 Subject: [PATCH] move successful push notification into repository --- extensions/git/package.json | 2 +- extensions/git/src/commands.ts | 4 ---- extensions/git/src/repository.ts | 10 ++++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 410fb6f0aa9..eb99282e708 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1156,4 +1156,4 @@ "@types/which": "^1.0.28", "mocha": "^3.2.0" } -} +} \ No newline at end of file diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 3eb6f857899..9d60c38e16a 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -1395,10 +1395,6 @@ export class CommandCenter { try { await repository.push(repository.HEAD); - const gitConfig = workspace.getConfiguration('git'); - if (gitConfig.get('showPushSuccessNotification')) { - window.showInformationMessage(localize('push success', "Successfully pushed.")); - } } catch (err) { if (err.gitErrorCode !== GitErrorCodes.NoUpstreamBranch) { throw err; diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 6051cc3cb48..4908ddac81f 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -557,6 +557,16 @@ export class Repository implements Disposable { this.disposables.push(new AutoFetcher(this, globalState)); + // https://github.com/Microsoft/vscode/issues/39039 + const onSuccessfulPush = filterEvent(this.onDidRunOperation, e => e.operation === Operation.Push && !e.error); + onSuccessfulPush(() => { + const gitConfig = workspace.getConfiguration('git'); + + if (gitConfig.get('showPushSuccessNotification')) { + window.showInformationMessage(localize('push success', "Successfully pushed.")); + } + }, null, this.disposables); + const statusBar = new StatusBarCommands(this); this.disposables.push(statusBar); statusBar.onDidChange(() => this._sourceControl.statusBarCommands = statusBar.commands, null, this.disposables); -- GitLab