mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Git - The git.sync command should use the git.rebaseWhenSync setting (#155511)
The git.sync command should use the git.rebaseWhenSync setting
This commit is contained in:
parent
e28a92fc1f
commit
03c16c9c00
|
@ -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<string>('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...")
|
||||
|
|
|
@ -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<void> {
|
||||
const config = workspace.getConfiguration('git', Uri.file(repository.root));
|
||||
const rebase = config.get<boolean>('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<void> {
|
||||
await Promise.all(this.model.repositories.map(async repository => {
|
||||
const config = workspace.getConfiguration('git', Uri.file(repository.root));
|
||||
const rebase = config.get<boolean>('rebaseWhenSync', false) === true;
|
||||
|
||||
const HEAD = repository.HEAD;
|
||||
|
||||
if (!HEAD || !HEAD.upstream) {
|
||||
return;
|
||||
}
|
||||
|
||||
await repository.sync(HEAD);
|
||||
await repository.sync(HEAD, rebase);
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<void> {
|
||||
return this._sync(head, false);
|
||||
}
|
||||
|
||||
@throttle
|
||||
async syncRebase(head: Branch): Promise<void> {
|
||||
return this._sync(head, true);
|
||||
sync(head: Branch, rebase: boolean): Promise<void> {
|
||||
return this._sync(head, rebase);
|
||||
}
|
||||
|
||||
private async _sync(head: Branch, rebase: boolean): Promise<void> {
|
||||
|
|
|
@ -145,10 +145,7 @@ class SyncStatusBar {
|
|||
text += this.repository.syncLabel;
|
||||
}
|
||||
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const rebaseWhenSync = config.get<string>('rebaseWhenSync');
|
||||
|
||||
command = rebaseWhenSync ? 'git.syncRebase' : 'git.sync';
|
||||
command = 'git.sync';
|
||||
tooltip = this.repository.syncTooltip;
|
||||
} else {
|
||||
icon = '$(cloud-upload)';
|
||||
|
|
Loading…
Reference in a new issue