From 5c0257926986a78c817077f563d605f0882fa34d Mon Sep 17 00:00:00 2001 From: wistcc Date: Wed, 20 Jun 2018 21:11:36 -0400 Subject: [PATCH] Adding the git.syncRebase setting --- extensions/git/package.json | 6 ++++++ extensions/git/package.nls.json | 1 + extensions/git/src/statusbar.ts | 12 ++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index d4a9ebb0d58..45c57d08a11 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -987,6 +987,12 @@ "scope": "resource", "default": 10, "description": "%config.detectSubmodulesLimit%" + }, + "git.syncRebase": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%config.syncRebase%" } } }, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 9b1a2332d1f..be722c51679 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -72,6 +72,7 @@ "config.detectSubmodules": "Controls whether to automatically detect git submodules.", "colors.added": "Color for added resources.", "config.detectSubmodulesLimit": "Controls the limit of git submodules detected.", + "config.syncRebase": "Synchronize changes using rebase.", "colors.modified": "Color for modified resources.", "colors.deleted": "Color for deleted resources.", "colors.untracked": "Color for untracked resources.", diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index 8d093e29b21..c392931efbf 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -5,7 +5,7 @@ 'use strict'; -import { Disposable, Command, EventEmitter, Event } from 'vscode'; +import { Disposable, Command, EventEmitter, Event, workspace } from 'vscode'; import { Branch } from './git'; import { Repository, Operation } from './repository'; import { anyEvent, dispose } from './util'; @@ -98,10 +98,18 @@ class SyncStatusBar { if (HEAD && HEAD.name && HEAD.commit) { if (HEAD.upstream) { + const config = workspace.getConfiguration('git'); + const gitSyncRebase = config.get('syncRebase'); + if (HEAD.ahead || HEAD.behind) { text += this.repository.syncLabel; } - command = 'git.sync'; + + if (gitSyncRebase) { + command = 'git.syncRebase'; + } else { + command = 'git.sync'; + } tooltip = localize('sync changes', "Synchronize Changes"); } else { icon = '$(cloud-upload)';