diff --git a/extensions/git/src/actionButton.ts b/extensions/git/src/actionButton.ts index 0695869be35..63ee474707b 100644 --- a/extensions/git/src/actionButton.ts +++ b/extensions/git/src/actionButton.ts @@ -213,11 +213,9 @@ export class ActionButtonCommand { const behind = this.state.HEAD.behind ? ` ${this.state.HEAD.behind}$(arrow-down)` : ''; const icon = this.state.isSyncInProgress ? '$(sync~spin)' : '$(sync)'; - const rebaseWhenSync = config.get('rebaseWhenSync'); - return { command: { - command: rebaseWhenSync ? 'git.syncRebase' : 'git.sync', + command: 'git.sync', title: `${icon}${behind}${ahead}`, tooltip: this.state.isSyncInProgress ? localize('syncing changes', "Synchronizing Changes...") diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 83d13150603..e0b7b5d4670 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -2575,17 +2575,16 @@ export class CommandCenter { } } - if (rebase) { - await repository.syncRebase(HEAD); - } else { - await repository.sync(HEAD); - } + await repository.sync(HEAD, rebase); } @command('git.sync', { repository: true }) async sync(repository: Repository): Promise { + const config = workspace.getConfiguration('git', Uri.file(repository.root)); + const rebase = config.get('rebaseWhenSync', false) === true; + try { - await this._sync(repository, false); + await this._sync(repository, rebase); } catch (err) { if (/Cancelled/i.test(err && (err.message || err.stderr || ''))) { return; @@ -2598,13 +2597,16 @@ export class CommandCenter { @command('git._syncAll') async syncAll(): Promise { await Promise.all(this.model.repositories.map(async repository => { + const config = workspace.getConfiguration('git', Uri.file(repository.root)); + const rebase = config.get('rebaseWhenSync', false) === true; + const HEAD = repository.HEAD; if (!HEAD || !HEAD.upstream) { return; } - await repository.sync(HEAD); + await repository.sync(HEAD, rebase); })); } diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 7c3ba92f792..995f9579e99 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -948,7 +948,6 @@ export class Repository implements Disposable { || e.affectsConfiguration('git.untrackedChanges', root) || e.affectsConfiguration('git.ignoreSubmodules', root) || e.affectsConfiguration('git.openDiffOnClick', root) - || e.affectsConfiguration('git.rebaseWhenSync', root) || e.affectsConfiguration('git.showActionButton', root) )(this.updateModelState, this, this.disposables); @@ -1510,13 +1509,8 @@ export class Repository implements Disposable { } @throttle - sync(head: Branch): Promise { - return this._sync(head, false); - } - - @throttle - async syncRebase(head: Branch): Promise { - return this._sync(head, true); + sync(head: Branch, rebase: boolean): Promise { + return this._sync(head, rebase); } private async _sync(head: Branch, rebase: boolean): Promise { diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index 68a9c91eb3a..bfb61d4266c 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -145,10 +145,7 @@ class SyncStatusBar { text += this.repository.syncLabel; } - const config = workspace.getConfiguration('git', Uri.file(this.repository.root)); - const rebaseWhenSync = config.get('rebaseWhenSync'); - - command = rebaseWhenSync ? 'git.syncRebase' : 'git.sync'; + command = 'git.sync'; tooltip = this.repository.syncTooltip; } else { icon = '$(cloud-upload)';