diff --git a/CHANGELOG.md b/CHANGELOG.md index 7872b1a..e985799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds a new _Browse Repository from Before Here_ (`gitlens.browseRepoBeforeRevision`) and _Browse Repository from Before Here in New Window_ (`gitlens.browseRepoBeforeRevisionInNewWindow`) commands - Adds _Repository from Before Here_ and _Repository from Before Here in New Window_ to the _Browse_ submenu of commits in the views - Adds a new _Copy Current Branch Name_ (`gitlens.copyCurrentBranch`) command to copy the current branch name to the clipboard — closes [#1306](https://github.com/eamodio/vscode-gitlens/issues/1306) — thanks to [PR #1307](https://github.com/eamodio/vscode-gitlens/pull/1307) by Ken Hom ([@kh0m](https://github.com/kh0m)) -- Adds a `gitlens.advanced.useAbbreviatedShaLengthForCopy` setting to copy the abbreviated commit SHA to the clipboard — closes [#1062](https://github.com/eamodio/vscode-gitlens/issues/1062) — thanks to [PR #1316](https://github.com/eamodio/vscode-gitlens/pull/1316) by Brendon Smith ([@br3ndonland](https://github.com/br3ndonland)) +- Adds a `gitlens.advanced.abbreviateShaOnCopy` setting specify to whether to copy full or abbreviated commit SHAs to the clipboard. Abbreviates to the length of `gitlens.advanced.abbreviatedShaLength` — closes [#1062](https://github.com/eamodio/vscode-gitlens/issues/1062) — thanks to [PR #1316](https://github.com/eamodio/vscode-gitlens/pull/1316) by Brendon Smith ([@br3ndonland](https://github.com/br3ndonland)) ### Changed diff --git a/README.md b/README.md index fd0a447..5cf3bc6 100644 --- a/README.md +++ b/README.md @@ -957,7 +957,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings') | `gitlens.showWelcomeOnInstall` | Specifies whether to show the Welcome (Quick Setup) experience on first install | | `gitlens.showWhatsNewAfterUpgrades` | Specifies whether to show the What's New notification after upgrading to new feature releases | | `gitlens.advanced.abbreviatedShaLength` | Specifies the length of abbreviated commit SHAs (shas) | -| `gitlens.advanced.useAbbreviatedShaLengthForCopy` | Specifies whether abbreviated commit SHAs should be copied instead of full-length SHAs. Respects `abbreviatedShaLength`. | +| `gitlens.advanced.abbreviateShaOnCopy` | Specifies whether to copy full or abbreviated commit SHAs to the clipboard. Abbreviates to the length of `gitlens.advanced.abbreviatedShaLength`.. | | `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command | | `gitlens.advanced.blame.delayAfterEdit` | Specifies the time (in milliseconds) to wait before re-blaming an unsaved document after an edit. Use 0 to specify an infinite wait | | `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 | diff --git a/package.json b/package.json index eb5b1a1..a6d1af5 100644 --- a/package.json +++ b/package.json @@ -2345,6 +2345,12 @@ "markdownDescription": "Specifies the length of abbreviated commit SHAs", "scope": "window" }, + "gitlens.advanced.abbreviateShaOnCopy": { + "type": "boolean", + "default": false, + "markdownDescription": "Specifies whether to copy full or abbreviated commit SHAs to the clipboard. Abbreviates to the length of `#gitlens.advanced.abbreviatedShaLength#`.", + "scope": "window" + }, "gitlens.advanced.blame.customArguments": { "type": [ "array", @@ -2464,12 +2470,6 @@ "markdownDescription": "Specifies the amount (percent) of similarity a deleted and added file pair must have to be considered a rename", "scope": "window" }, - "gitlens.advanced.useAbbreviatedShaLengthForCopy": { - "type": "boolean", - "default": false, - "markdownDescription": "Specifies whether abbreviated commit SHAs should be copied instead of full-length SHAs. Respects `abbreviatedShaLength`.", - "scope": "window" - }, "gitlens.advanced.useSymmetricDifferenceNotation": { "type": "boolean", "default": true, diff --git a/src/commands/copyShaToClipboard.ts b/src/commands/copyShaToClipboard.ts index 76341c9..7c53cfc 100644 --- a/src/commands/copyShaToClipboard.ts +++ b/src/commands/copyShaToClipboard.ts @@ -29,7 +29,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand { protected preExecute(context: CommandContext, args?: CopyShaToClipboardCommandArgs) { if (isCommandContextViewNodeHasCommit(context)) { args = { ...args }; - args.sha = Container.config.advanced.useAbbreviatedShaLengthForCopy + args.sha = Container.config.advanced.abbreviateShaOnCopy ? context.node.commit.shortSha : context.node.commit.sha; return this.execute(context.editor, context.node.commit.uri, args); diff --git a/src/config.ts b/src/config.ts index ac0ec92..d87b35f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -278,6 +278,7 @@ export enum ViewShowBranchComparison { export interface AdvancedConfig { abbreviatedShaLength: number; + abbreviateShaOnCopy: boolean; blame: { customArguments: string[] | null; delayAfterEdit: number; @@ -304,7 +305,6 @@ export interface AdvancedConfig { }; repositorySearchDepth: number; similarityThreshold: number | null; - useAbbreviatedShaLengthForCopy: boolean; useSymmetricDifferenceNotation: boolean; }