Explorar el Código

Fixes #2344 honor sha copy length in graph/details

main
Eric Amodio hace 2 años
padre
commit
5815826df2
Se han modificado 3 ficheros con 11 adiciones y 6 borrados
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -4
      src/commands/copyShaToClipboard.ts
  3. +5
    -2
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 1
- 0
CHANGELOG.md Ver fichero

@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#2344](https://github.com/gitkraken/vscode-gitlens/issues/2344) - copying abbreviated commit SHAs is not working
- Fixes [#2342](https://github.com/gitkraken/vscode-gitlens/issues/2342) - Local remotes are incorrectly treated as private
- Fixes [#2052](https://github.com/gitkraken/vscode-gitlens/issues/2052) - Interactive Rebase fails to start when using xonsh shell due to command quoting
- Fixes [#2141](https://github.com/gitkraken/vscode-gitlens/issues/2141) - GitLens's rebase UI randomly fails loading interactive rebase when performed outside of VSC

+ 5
- 4
src/commands/copyShaToClipboard.ts Ver fichero

@ -4,6 +4,7 @@ import { configuration } from '../configuration';
import { Commands } from '../constants';
import type { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { GitRevision } from '../git/models/reference';
import { Logger } from '../logger';
import { showGenericErrorMessage } from '../messages';
import { command } from '../system/command';
@ -30,9 +31,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
protected override preExecute(context: CommandContext, args?: CopyShaToClipboardCommandArgs) {
if (isCommandContextViewNodeHasCommit(context)) {
args = { ...args };
args.sha = configuration.get('advanced.abbreviateShaOnCopy')
? context.node.commit.shortSha
: context.node.commit.sha;
args.sha = context.node.commit.sha;
return this.execute(
context.editor,
context.node.commit.file?.uri ?? context.node.commit.getRepository()?.uri,
@ -86,7 +85,9 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
}
}
await env.clipboard.writeText(args.sha);
await env.clipboard.writeText(
configuration.get('advanced.abbreviateShaOnCopy') ? GitRevision.shorten(args.sha) : args.sha,
);
} catch (ex) {
Logger.error(ex, 'CopyShaToClipboardCommand');
void showGenericErrorMessage('Unable to copy commit SHA');

+ 5
- 2
src/webviews/commitDetails/commitDetailsWebviewView.ts Ver fichero

@ -4,7 +4,8 @@ import type {
TreeViewSelectionChangeEvent,
TreeViewVisibilityChangeEvent,
} from 'vscode';
import { CancellationTokenSource, Disposable, env, Uri, window } from 'vscode';
import { CancellationTokenSource, Disposable, Uri, window } from 'vscode';
import type { CopyShaToClipboardCommandArgs } from '../../commands';
import { executeGitCommand, GitActions } from '../../commands/gitCommands.actions';
import { configuration } from '../../configuration';
import { Commands, ContextKeys, CoreCommands } from '../../constants';
@ -294,7 +295,9 @@ export class CommitDetailsWebviewView extends WebviewViewBase
if (params.alt) {
this.showCommitPicker();
} else if (this._context.commit != null) {
void env.clipboard.writeText(this._context.commit.sha);
void executeCommand<CopyShaToClipboardCommandArgs>(Commands.CopyShaToClipboard, {
sha: this._context.commit.sha,
});
}
break;
}

Cargando…
Cancelar
Guardar