From 7a272ad30f46eff24aab0ce5bf4f8532c44ad615 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 23 May 2021 16:12:30 -0400 Subject: [PATCH] Closes #1505: open folder history on root folders --- CHANGELOG.md | 1 + package.json | 2 +- src/views/nodes/fileHistoryNode.ts | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d682715..f9025ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Added - Adds the ability to filter comparisons to show only either the left-side or right-side file differences +- Adds the _Open Folder History_ command to root folders — closes [#1505](https://github.com/eamodio/vscode-gitlens/issues/1505) ### Changed diff --git a/package.json b/package.json index 8d29c06..63d3270 100644 --- a/package.json +++ b/package.json @@ -6824,7 +6824,7 @@ }, { "command": "gitlens.openFolderHistory", - "when": "!explorerResourceIsRoot && explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history", + "when": "explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history", "group": "4_timeline@2" }, { diff --git a/src/views/nodes/fileHistoryNode.ts b/src/views/nodes/fileHistoryNode.ts index b6e81fb..bfd8097 100644 --- a/src/views/nodes/fileHistoryNode.ts +++ b/src/views/nodes/fileHistoryNode.ts @@ -1,4 +1,5 @@ 'use strict'; +import * as paths from 'path'; import { Disposable, TreeItem, TreeItemCollapsibleState, window } from 'vscode'; import { LoadMoreNode, MessageNode } from './common'; import { CommitNode } from './commitNode'; @@ -146,6 +147,15 @@ export class FileHistoryNode extends SubscribeableViewNode impl } get label() { + // Check if this is a base folder + if (this.uri.fileName === '') { + return `${paths.basename(this.uri.fsPath)}${ + this.uri.sha + ? ` ${this.uri.sha === GitRevision.deletedOrMissing ? this.uri.shortSha : `(${this.uri.shortSha})`}` + : '' + }`; + } + return `${this.uri.fileName}${ this.uri.sha ? ` ${this.uri.sha === GitRevision.deletedOrMissing ? this.uri.shortSha : `(${this.uri.shortSha})`}`