diff --git a/README.md b/README.md
index 356a947..1f5e494 100644
--- a/README.md
+++ b/README.md
@@ -128,7 +128,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Provides a context menu with `Open Repository in Remote`, and `Refresh` commands
- `Branches` node — provides a list of the local branches
- - Indicates which branch is the current branch
+ - Indicates which branch is the current branch and [optionally](#gitlens-custom-view-settings) shows the remote tracking branch
- Expand each branch to easily see its revision (commit) history
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
@@ -337,6 +337,7 @@ GitLens is highly customizable and provides many configuration settings to allow
|Name | Description
|-----|------------
|`gitlens.gitExplorer.view`|Specifies the starting view (mode) of the `GitLens` custom view
`history` - shows the commit history of the active file
`repository` - shows a repository explorer"
+|`gitlens.gitExplorer.showTrackingBranch`|Specifies whether or not to show the tracking branch when displaying local branches in the `GitLens` custom view"
|`gitlens.gitExplorer.commitFormat`|Specifies the format of committed changes in the `GitLens` custom view
Available tokens
${id} - commit id
${author} - commit author
${message} - commit message
${ago} - relative commit date (e.g. 1 day ago)
${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)
${authorAgo} - commit author, relative commit date
See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|`gitlens.gitExplorer.commitFileFormat`|Specifies the format of a committed file in the `GitLens` custom view
Available tokens
${file} - file name
${filePath} - file name and path
${path} - file path
|`gitlens.gitExplorer.stashFormat`|Specifies the format of stashed changes in the `GitLens` custom view
Available tokens
${id} - commit id
${author} - commit author
${message} - commit message
${ago} - relative commit date (e.g. 1 day ago)
${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)
${authorAgo} - commit author, relative commit date
See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
diff --git a/package.json b/package.json
index 07bf4bb..0f97b2c 100644
--- a/package.json
+++ b/package.json
@@ -413,15 +413,6 @@
"default": null,
"description": "Specifies how all absolute dates will be formatted by default\nSee https://momentjs.com/docs/#/displaying/format/ for valid formats"
},
- "gitlens.gitExplorer.view": {
- "type": "string",
- "default": "repository",
- "enum": [
- "history",
- "repository"
- ],
- "description": "Specifies the starting view (mode) of the `GitLens` custom view\n `history` - shows the commit history of the active file\n `repository` - shows a repository explorer"
- },
"gitlens.gitExplorer.commitFormat": {
"type": "string",
"default": "${message} \u00a0\u2022\u00a0 ${authorAgo} \u00a0\u2022\u00a0 ${id}",
@@ -432,6 +423,11 @@
"default": "${filePath}",
"description": "Specifies the format of a committed file in the `GitLens` custom view\nAvailable tokens\n ${file} - file name\n ${filePath} - file name and path\n ${path} - file path"
},
+ "gitlens.gitExplorer.showTrackingBranch": {
+ "type": "boolean",
+ "default": true,
+ "description": "Specifies whether or not to show the tracking branch when displaying local branches in the `GitLens` custom view"
+ },
"gitlens.gitExplorer.stashFormat": {
"type": "string",
"default": "${message}",
@@ -442,6 +438,15 @@
"default": "${filePath}",
"description": "Specifies the format of a stashed file in the `GitLens` custom view\nAvailable tokens\n ${file} - file name\n ${filePath} - file name and path\n ${path} - file path"
},
+ "gitlens.gitExplorer.view": {
+ "type": "string",
+ "default": "repository",
+ "enum": [
+ "history",
+ "repository"
+ ],
+ "description": "Specifies the starting view (mode) of the `GitLens` custom view\n `history` - shows the commit history of the active file\n `repository` - shows a repository explorer"
+ },
"gitlens.statusBar.enabled": {
"type": "boolean",
"default": true,
diff --git a/src/configuration.ts b/src/configuration.ts
index c2b17fc..2633f44 100644
--- a/src/configuration.ts
+++ b/src/configuration.ts
@@ -299,6 +299,7 @@ export interface IConfig {
gitExplorer: {
view: GitExplorerView;
+ showTrackingBranch: boolean;
commitFormat: string;
commitFileFormat: string;
stashFormat: string;
diff --git a/src/views/branchHistoryNode.ts b/src/views/branchHistoryNode.ts
index 266bd66..c760751 100644
--- a/src/views/branchHistoryNode.ts
+++ b/src/views/branchHistoryNode.ts
@@ -4,13 +4,13 @@ import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { GlyphChars } from '../constants';
import { ExplorerNode, ResourceType } from './explorerNode';
-import { GitBranch, GitRemote, GitService, GitUri } from '../gitService';
+import { GitBranch, GitService, GitUri } from '../gitService';
export class BranchHistoryNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:branch-history';
- constructor(public readonly branch: GitBranch, private readonly remote: GitRemote | undefined, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
+ constructor(public readonly branch: GitBranch, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
super(uri);
}
@@ -22,10 +22,11 @@ export class BranchHistoryNode extends ExplorerNode {
}
async getTreeItem(): Promise {
- const name = this.remote !== undefined
- ? this.branch.name.substring(this.remote.name.length + 1)
- : this.branch.name;
- const item = new TreeItem(`${name}${this.branch!.current ? ` ${GlyphChars.Space} ${GlyphChars.Check}` : ''}`, TreeItemCollapsibleState.Collapsed);
+ let name = this.branch.getName();
+ if (!this.branch.remote && this.branch.tracking !== undefined && this.git.config.gitExplorer.showTrackingBranch) {
+ name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRight}${GlyphChars.Space} ${this.branch.tracking}`;
+ }
+ const item = new TreeItem(`${this.branch!.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, TreeItemCollapsibleState.Collapsed);
item.contextValue = this.resourceType;
item.iconPath = {
diff --git a/src/views/branchesNode.ts b/src/views/branchesNode.ts
index 897668f..a87e69a 100644
--- a/src/views/branchesNode.ts
+++ b/src/views/branchesNode.ts
@@ -18,7 +18,7 @@ export class BranchesNode extends ExplorerNode {
if (branches === undefined) return [];
branches.sort((a, b) => (a.current ? -1 : 1) - (b.current ? -1 : 1) || a.name.localeCompare(b.name));
- return [...Iterables.filterMap(branches, b => b.remote ? undefined : new BranchHistoryNode(b, undefined, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
+ return [...Iterables.filterMap(branches, b => b.remote ? undefined : new BranchHistoryNode(b, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
}
getTreeItem(): TreeItem {
diff --git a/src/views/remoteNode.ts b/src/views/remoteNode.ts
index c19ba24..7b478b8 100644
--- a/src/views/remoteNode.ts
+++ b/src/views/remoteNode.ts
@@ -18,7 +18,7 @@ export class RemoteNode extends ExplorerNode {
if (branches === undefined) return [];
branches.sort((a, b) => a.name.localeCompare(b.name));
- return [...Iterables.filterMap(branches, b => !b.remote || !b.name.startsWith(this.remote.name) ? undefined : new BranchHistoryNode(b, this.remote, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
+ return [...Iterables.filterMap(branches, b => !b.remote || !b.name.startsWith(this.remote.name) ? undefined : new BranchHistoryNode(b, this.uri, this.git.config.gitExplorer.commitFormat, this.context, this.git))];
}
getTreeItem(): TreeItem {