diff --git a/CHANGELOG.md b/CHANGELOG.md index cbb80fc..82596ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] ### Added - Adds a tree layout option to branches in the *GitLens* explorer — closes [#258](https://github.com/eamodio/vscode-gitlens/issues/258) thanks to [PR #260](https://github.com/eamodio/vscode-gitlens/pull/260) by Yukai Huang ([@Yukaii](https://github.com/Yukaii))! +- Adds *Follow Renames* command (`gitlens.gitExplorer.setRenameFollowingOn`) to the **GitLens** explorer *History* view to follow file renames in the history +- Adds *Don't Follow Renames* command (`gitlens.gitExplorer.setRenameFollowingOff`) to the **GitLens** explorer *History* view to not follow file renames in the history +- Adds `gitlens.advanced.fileHistoryFollowsRenames` setting to specify whether file histories will follow renames -- will affect how merge commits are shown in histories — closes [#259](https://github.com/eamodio/vscode-gitlens/issues/259) ### Fixed - Fixes [#35](https://github.com/eamodio/vscode-gitlens/issues/35) - Copy Commit Sha to Clipboard not working (linux) diff --git a/README.md b/README.md index 8ac7d90..0cb2a66 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Here are a few ways you can help — feel free to choose more than one A [customizable](#gitlens-explorer-settings "Jump to the GitLens Explorer settings") explorer to navigate and explore repositories or file histories. The GitLens explorer provides two views (modes) — a Repository view and a History view. - A toolbar provides *Search Commits*, *Switch to Repository View* or *Switch to History View*, and *Refresh* commands - Quickly switch between views using the *Switch to Repository View* or *Switch to History View* commands - - A context menu provides *Automatic Layout*, *List Layout*, and *Tree Layout* commands + - A context menu provides *Automatic Layout*, *List Layout*, *Tree Layout*, *Enable Automatic Refresh* or *Disable Automatic Refresh*, and *Follow Renames* or *Don't Follow Renames* commands #### Repository view
@@ -595,6 +595,7 @@ See also [Explorer Settings](#explorer-settings "Jump to the Explorer settings")
|`gitlens.advanced.blame.sizeThresholdAfterEdit`|Specifies the maximum document size (in lines) allowed to be re-blamed after an edit while still unsaved. Use 0 to specify no maximum
|`gitlens.advanced.caching.enabled`|Specifies whether git output will be cached — changing the default is not recommended
|`gitlens.advanced.git`|Specifies the git path to use
+|`gitlens.advanced.fileHistoryFollowsRenames`|Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories
|`gitlens.advanced.maxListItems`|Specifies the maximum number of items to show in a list. Use 0 to specify no maximum
|`gitlens.advanced.menus`|Specifies which commands will be added to which menus
|`gitlens.advanced.messages`|Specifies which messages should be suppressed
diff --git a/package.json b/package.json
index d0d544b..e658b34 100644
--- a/package.json
+++ b/package.json
@@ -779,6 +779,12 @@
"description": "Specifies the git path to use",
"scope": "window"
},
+ "gitlens.advanced.fileHistoryFollowsRenames": {
+ "type": "boolean",
+ "default": true,
+ "description": "Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories",
+ "scope": "window"
+ },
"gitlens.advanced.maxListItems": {
"type": "number",
"default": 200,
@@ -1532,6 +1538,16 @@
"category": "GitLens"
},
{
+ "command": "gitlens.gitExplorer.setRenameFollowingOn",
+ "title": "Follow Renames",
+ "category": "GitLens"
+ },
+ {
+ "command": "gitlens.gitExplorer.setRenameFollowingOff",
+ "title": "Don't Follow Renames",
+ "category": "GitLens"
+ },
+ {
"command": "gitlens.gitExplorer.switchToHistoryView",
"title": "Switch to History View",
"category": "GitLens",
@@ -1946,6 +1962,14 @@
"when": "false"
},
{
+ "command": "gitlens.gitExplorer.setRenameFollowingOn",
+ "when": "false"
+ },
+ {
+ "command": "gitlens.gitExplorer.setRenameFollowingOff",
+ "when": "false"
+ },
+ {
"command": "gitlens.gitExplorer.switchToHistoryView",
"when": "gitlens:enabled && gitlens:gitExplorer:view == repository"
},
@@ -2255,6 +2279,16 @@
"group": "2_gitlens"
},
{
+ "command": "gitlens.gitExplorer.setRenameFollowingOn",
+ "when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history && !config.gitlens.advanced.fileHistoryFollowsRenames",
+ "group": "2_gitlens_1"
+ },
+ {
+ "command": "gitlens.gitExplorer.setRenameFollowingOff",
+ "when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history && config.gitlens.advanced.fileHistoryFollowsRenames",
+ "group": "2_gitlens_1"
+ },
+ {
"command": "gitlens.showCommitSearch",
"when": "view == gitlens.resultsExplorer",
"group": "navigation@1"
diff --git a/src/configuration.ts b/src/configuration.ts
index 27ee312..d424539 100644
--- a/src/configuration.ts
+++ b/src/configuration.ts
@@ -110,8 +110,23 @@ export class Configuration {
return Functions.propOf(emptyConfig as IConfig, name);
}
- update(section: string, value: any, target: ConfigurationTarget) {
- return workspace.getConfiguration(ExtensionKey).update(section, value, target);
+ update(section: string, value: any, target: ConfigurationTarget, resource?: Uri | null) {
+ return workspace
+ .getConfiguration(ExtensionKey, target === ConfigurationTarget.Global ? undefined : resource!)
+ .update(section, value, target);
+ }
+
+ async updateEffective(section: string, value: any, resource: Uri | null = null) {
+ const inspect = await configuration.inspect(section, resource)!;
+ if (inspect.workspaceFolderValue !== undefined) {
+ await configuration.update(section, value, ConfigurationTarget.WorkspaceFolder, resource);
+ }
+ else if (inspect.workspaceValue !== undefined) {
+ await configuration.update(section, value, ConfigurationTarget.Workspace);
+ }
+ else {
+ await configuration.update(section, value, ConfigurationTarget.Global);
+ }
}
}
diff --git a/src/gitService.ts b/src/gitService.ts
index 603ee80..ce1ff9f 100644
--- a/src/gitService.ts
+++ b/src/gitService.ts
@@ -325,13 +325,13 @@ export class GitService extends Disposable {
}
async findNextCommit(repoPath: string, fileName: string, ref?: string): Promise