Przeglądaj źródła

Switches everything to use full shas

main
Eric Amodio 7 lat temu
rodzic
commit
762fa545c7
20 zmienionych plików z 60 dodań i 37 usunięć
  1. +2
    -3
      src/blameAnnotationFormatter.ts
  2. +2
    -2
      src/blameAnnotationProvider.ts
  3. +1
    -1
      src/commands/diffLineWithPrevious.ts
  4. +1
    -1
      src/commands/diffWithNext.ts
  5. +2
    -2
      src/commands/diffWithPrevious.ts
  6. +1
    -1
      src/commands/diffWithWorking.ts
  7. +1
    -1
      src/commands/showQuickCommitDetails.ts
  8. +4
    -2
      src/commands/showQuickCommitFileDetails.ts
  9. +3
    -2
      src/git/enrichers/blameParserEnricher.ts
  10. +4
    -2
      src/git/enrichers/logParserEnricher.ts
  11. +2
    -1
      src/git/git.ts
  12. +12
    -0
      src/git/gitEnrichment.ts
  13. +4
    -0
      src/git/gitUri.ts
  14. +1
    -1
      src/gitCodeLensProvider.ts
  15. +1
    -1
      src/gitContentProvider.ts
  16. +2
    -2
      src/gitRevisionCodeLensProvider.ts
  17. +6
    -6
      src/quickPicks/commitDetails.ts
  18. +7
    -7
      src/quickPicks/commitFileDetails.ts
  19. +1
    -1
      src/quickPicks/fileHistory.ts
  20. +3
    -1
      src/quickPicks/gitQuickPicks.ts

+ 2
- 3
src/blameAnnotationFormatter.ts Wyświetl plik

@ -3,7 +3,6 @@ import { IBlameConfig } from './configuration';
import { GitCommit, IGitCommitLine } from './gitProvider';
import * as moment from 'moment';
export const defaultShaLength = 8;
export const defaultAbsoluteDateLength = 10;
export const defaultRelativeDateLength = 13;
export const defaultAuthorLength = 16;
@ -34,7 +33,7 @@ export enum BlameAnnotationFormat {
export class BlameAnnotationFormatter {
static getAnnotation(config: IBlameConfig, commit: GitCommit, format: BlameAnnotationFormat) {
const sha = commit.sha.substring(0, defaultShaLength);
const sha = commit.shortSha;
let message = this.getMessage(config, commit, format === BlameAnnotationFormat.Unconstrained ? 0 : defaultMessageLength);
if (format === BlameAnnotationFormat.Unconstrained) {
@ -70,7 +69,7 @@ export class BlameAnnotationFormatter {
return `\`${'0'.repeat(8)}\`   __Uncommitted changes__`;
}
return `\`${commit.sha}\`   __${commit.author}__, ${moment(commit.date).fromNow()} _(${moment(commit.date).format(config.annotation.dateFormat || 'MMMM Do, YYYY h:MMa')})_ \n\n${message}`;
return `\`${commit.shortSha}\`   __${commit.author}__, ${moment(commit.date).fromNow()} _(${moment(commit.date).format(config.annotation.dateFormat || 'MMMM Do, YYYY h:MMa')})_ \n\n${message}`;
}
static getAuthorAndDate(config: IBlameConfig, commit: GitCommit, format: string, force: boolean = false) {

+ 2
- 2
src/blameAnnotationProvider.ts Wyświetl plik

@ -1,7 +1,7 @@
'use strict';
import { Iterables } from './system';
import { DecorationInstanceRenderOptions, DecorationOptions, Disposable, ExtensionContext, Range, TextDocument, TextEditor, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
import { BlameAnnotationFormat, BlameAnnotationFormatter, cssIndent, defaultShaLength, defaultAuthorLength } from './blameAnnotationFormatter';
import { BlameAnnotationFormat, BlameAnnotationFormatter, cssIndent, defaultAuthorLength } from './blameAnnotationFormatter';
import { BlameDecorations } from './blameAnnotationController';
import { TextDocumentComparer } from './comparers';
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
@ -167,7 +167,7 @@ export class BlameAnnotationProvider extends Disposable {
if (!isEmptyOrWhitespace) {
switch (++count) {
case 0:
gutter = commit.sha.substring(0, defaultShaLength);
gutter = commit.shortSha;
break;
case 1:
gutter = `${cssIndent} ${BlameAnnotationFormatter.getAuthor(this._config, commit, defaultAuthorLength, true)}`;

+ 1
- 1
src/commands/diffLineWithPrevious.ts Wyświetl plik

@ -59,7 +59,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
this.git.getVersionedFile(gitUri.fsPath, gitUri.repoPath, gitUri.sha),
this.git.getVersionedFile(commit.uri.fsPath, commit.repoPath, commit.sha)
]);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.uri.fsPath)} (${commit.sha}) ↔ ${path.basename(gitUri.fsPath)} (${gitUri.sha})`);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.uri.fsPath)} (${commit.shortSha}) ↔ ${path.basename(gitUri.fsPath)} (${gitUri.shortSha})`);
// TODO: Figure out how to focus the left pane
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' });
}

+ 1
- 1
src/commands/diffWithNext.ts Wyświetl plik

@ -63,7 +63,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
this.git.getVersionedFile(commit.nextUri.fsPath, commit.repoPath, commit.nextSha),
this.git.getVersionedFile(commit.uri.fsPath, commit.repoPath, commit.sha)
]);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.uri.fsPath)} (${commit.sha}) ↔ ${path.basename(commit.nextUri.fsPath)} (${commit.nextSha})`);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.uri.fsPath)} (${commit.shortSha}) ↔ ${path.basename(commit.nextUri.fsPath)} (${commit.nextShortSha})`);
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' });
}
catch (ex) {

+ 2
- 2
src/commands/diffWithPrevious.ts Wyświetl plik

@ -55,7 +55,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
}
if (!commit.previousSha) {
return window.showInformationMessage(`Commit ${commit.sha} (${commit.author}, ${moment(commit.date).fromNow()}) has no previous commit`);
return window.showInformationMessage(`Commit ${commit.shortSha} (${commit.author}, ${moment(commit.date).fromNow()}) has no previous commit`);
}
try {
@ -63,7 +63,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
this.git.getVersionedFile(commit.uri.fsPath, commit.repoPath, commit.sha),
this.git.getVersionedFile(commit.previousUri.fsPath, commit.repoPath, commit.previousSha)
]);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.previousUri.fsPath)} (${commit.previousSha}) ↔ ${path.basename(commit.uri.fsPath)} (${commit.sha})`);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(lhs), Uri.file(rhs), `${path.basename(commit.previousUri.fsPath)} (${commit.previousShortSha}) ↔ ${path.basename(commit.uri.fsPath)} (${commit.shortSha})`);
// TODO: Figure out how to focus the left pane
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' });
}

+ 1
- 1
src/commands/diffWithWorking.ts Wyświetl plik

@ -42,7 +42,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
try {
const compare = await this.git.getVersionedFile(commit.uri.fsPath, commit.repoPath, commit.sha);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), gitUri.fileUri(), `${path.basename(commit.uri.fsPath)} (${commit.sha}) ↔ ${path.basename(gitUri.fsPath)}`);
await commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), gitUri.fileUri(), `${path.basename(commit.uri.fsPath)} (${commit.shortSha}) ↔ ${path.basename(gitUri.fsPath)}`);
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' });
}
catch (ex) {

+ 1
- 1
src/commands/showQuickCommitDetails.ts Wyświetl plik

@ -70,7 +70,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCommand {
// Create a command to get back to where we are right now
new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${pick.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${pick.shortSha}`
}, Commands.ShowQuickCommitDetails, [new GitUri(commit.uri, commit), sha, commit, goBackCommand]));
}
catch (ex) {

+ 4
- 2
src/commands/showQuickCommitFileDetails.ts Wyświetl plik

@ -57,11 +57,13 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCommand {
// TODO: Leave this at undefined until findMostRecentCommitForFile actually works
const workingFileName = !workingCommit ? commit.fileName : undefined;
const shortSha = sha.substring(0, 8);
if (!goBackCommand) {
// Create a command to get back to the commit details
goBackCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${shortSha}`
}, Commands.ShowQuickCommitDetails, [new GitUri(commit.uri, commit), sha, commit]);
}
@ -69,7 +71,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCommand {
// Create a command to get back to where we are right now
new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(file-text) ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(file-text) ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${shortSha}`
}, Commands.ShowQuickCommitFileDetails, [new GitUri(commit.uri, commit), sha, commit, goBackCommand, options]),
{ showFileHistory: options.showFileHistory });

+ 3
- 2
src/git/enrichers/blameParserEnricher.ts Wyświetl plik

@ -5,6 +5,7 @@ import * as path from 'path';
interface IBlameEntry {
sha: string;
line: number;
originalLine: number;
lineCount: number;
@ -53,7 +54,7 @@ export class GitBlameParserEnricher implements IGitEnricher {
if (!entry) {
entry = {
sha: lineParts[0].substring(0, 8),
sha: lineParts[0],
originalLine: parseInt(lineParts[1], 10) - 1,
line: parseInt(lineParts[2], 10) - 1,
lineCount: parseInt(lineParts[3], 10)
@ -102,7 +103,7 @@ export class GitBlameParserEnricher implements IGitEnricher {
break;
case 'previous':
entry.previousSha = lineParts[1].substring(0, 8);
entry.previousSha = lineParts[1];
entry.previousFileName = lineParts.slice(2).join(' ');
break;

+ 4
- 2
src/git/enrichers/logParserEnricher.ts Wyświetl plik

@ -21,6 +21,8 @@ interface ILogEntry {
summary?: string;
}
const shaRegex = /^[a-f0-9]{40}$/;
export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
private _parseEntries(data: string, isRepoPath: boolean): ILogEntry[] {
@ -40,9 +42,9 @@ export class GitLogParserEnricher implements IGitEnricher {
}
if (!entry) {
if (!/^[a-f0-9]{40}$/.test(lineParts[0])) continue;
if (!shaRegex.test(lineParts[0])) continue;
entry = {
sha: lineParts[0].substring(0, 8)
sha: lineParts[0]
};
continue;

+ 2
- 1
src/git/git.ts Wyświetl plik

@ -115,9 +115,10 @@ export default class Git {
static async getVersionedFile(fileName: string, repoPath: string, sha: string) {
const data = await Git.getVersionedFileText(fileName, repoPath, sha);
const shortSha = sha.substring(0, 8);
const ext = path.extname(fileName);
return new Promise<string>((resolve, reject) => {
tmp.file({ prefix: `${path.basename(fileName, ext)}-${sha}__`, postfix: ext },
tmp.file({ prefix: `${path.basename(fileName, ext)}-${shortSha}__`, postfix: ext },
(err, destination, fd, cleanupCallback) => {
if (err) {
reject(err);

+ 12
- 0
src/git/gitEnrichment.ts Wyświetl plik

@ -80,6 +80,10 @@ export class GitCommit implements IGitCommit {
this.previousFileName = previousFileName;
}
get shortSha() {
return this.sha.substring(0, 8);
}
get isUncommitted(): boolean {
if (this._isUncommitted === undefined) {
this._isUncommitted = Git.isUncommitted(this.sha);
@ -87,6 +91,10 @@ export class GitCommit implements IGitCommit {
return this._isUncommitted;
}
get previousShortSha() {
return this.previousSha && this.previousSha.substring(0, 8);
}
get previousUri(): Uri {
return this.previousFileName ? Uri.file(path.join(this.repoPath, this.previousFileName)) : this.uri;
}
@ -138,6 +146,10 @@ export class GitLogCommit extends GitCommit {
}
}
get nextShortSha() {
return this.nextSha && this.nextSha.substring(0, 8);
}
get nextUri(): Uri {
return this.nextFileName ? Uri.file(path.join(this.repoPath, this.nextFileName)) : this.uri;
}

+ 4
- 0
src/git/gitUri.ts Wyświetl plik

@ -49,6 +49,10 @@ export class GitUri extends Uri {
}
}
get shortSha() {
return this.sha && this.sha.substring(0, 8);
}
fileUri() {
return Uri.file(this.sha ? this.path : this.fsPath);
}

+ 1
- 1
src/gitCodeLensProvider.ts Wyświetl plik

@ -262,7 +262,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
const recentCommit = Iterables.first(blame.commits.values());
title = `${recentCommit.author}, ${moment(recentCommit.date).fromNow()}`;
if (this._config.advanced.debug && this._config.advanced.output.level === OutputLevel.Verbose) {
title += ` [Commit (${recentCommit.sha}), Symbol (${SymbolKind[lens.symbolKind]}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1})]`;
title += ` [Commit (${recentCommit.shortSha}), Symbol (${SymbolKind[lens.symbolKind]}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1})]`;
}
switch (this._config.codeLens.recentChange.command) {

+ 1
- 1
src/gitContentProvider.ts Wyświetl plik

@ -23,7 +23,7 @@ export class GitContentProvider implements TextDocumentContentProvider {
}
catch (ex) {
Logger.error('[GitLens.GitContentProvider]', 'getVersionedFileText', ex);
await window.showErrorMessage(`Unable to show Git revision ${data.sha} of '${path.relative(data.repoPath, fileName)}'`);
await window.showErrorMessage(`Unable to show Git revision ${data.sha.substring(0, 8)} of '${path.relative(data.repoPath, fileName)}'`);
return undefined;
}
}

+ 2
- 2
src/gitRevisionCodeLensProvider.ts Wyświetl plik

@ -54,7 +54,7 @@ export class GitRevisionCodeLensProvider implements CodeLensProvider {
_resolveDiffWithWorkingTreeCodeLens(lens: GitDiffWithWorkingCodeLens, token: CancellationToken): Thenable<CodeLens> {
lens.command = {
title: `Compare ${lens.commit.sha} with Working Tree`,
title: `Compare ${lens.commit.shortSha} with Working Tree`,
command: Commands.DiffWithWorking,
arguments: [
Uri.file(lens.fileName),
@ -67,7 +67,7 @@ export class GitRevisionCodeLensProvider implements CodeLensProvider {
_resolveGitDiffWithPreviousCodeLens(lens: GitDiffWithPreviousCodeLens, token: CancellationToken): Thenable<CodeLens> {
lens.command = {
title: `Compare ${lens.commit.sha} with Previous ${lens.commit.previousSha}`,
title: `Compare ${lens.commit.shortSha} with Previous ${lens.commit.previousShortSha}`,
command: Commands.DiffWithPrevious,
arguments: [
Uri.file(lens.fileName),

+ 6
- 6
src/quickPicks/commitDetails.ts Wyświetl plik

@ -14,8 +14,8 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
const uris = commit.fileStatuses.map(_ => GitProvider.toGitContentUri(commit.sha, _.fileName, repoPath, commit.originalFileName));
super(uris, item || {
label: `$(file-symlink-file) Open Changed Files`,
description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.sha}`
//detail: `Opens all of the changed files in $(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.shortSha}`
//detail: `Opens all of the changed files in $(git-commit) ${commit.shortSha}`
});
}
}
@ -42,7 +42,7 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Commit Sha to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [uri, commit.sha]));
items.splice(index++, 0, new CommandQuickPickItem({
@ -52,12 +52,12 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Previous Commit`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousSha || `${commit.sha}^`} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha || `${commit.shortSha}^`} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.DiffDirectory, [commit.uri, commit.previousSha || `${commit.sha}^`, commit.sha]));
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-directory) Working Tree`
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-directory) Working Tree`
}, Commands.DiffDirectory, [uri, commit.sha]));
items.splice(index++, 0, new CommandQuickPickItem({
@ -77,7 +77,7 @@ export class CommitDetailsQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
placeHolder: `${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
Keyboard.instance.setKeyCommand('right', item);

+ 7
- 7
src/quickPicks/commitFileDetails.ts Wyświetl plik

@ -13,7 +13,7 @@ export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPick
const uri = GitProvider.toGitContentUri(commit);
super(uri, item || {
label: `$(file-symlink-file) Open File`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${commit.shortSha}`
});
}
}
@ -48,25 +48,25 @@ export class CommitFileDetailsQuickPick {
if (!options.showFileHistory) {
items.push(new CommandQuickPickItem({
label: `$(git-commit) Show Commit Details`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickCommitDetails, [new GitUri(commit.uri, commit), commit.sha, commit, currentCommand]));
}
if (commit.previousSha) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare with Previous Commit`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
}, Commands.DiffWithPrevious, [commit.uri, commit]));
}
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingName}`
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingName}`
}, Commands.DiffWithWorking, [uri, commit]));
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit Sha to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [uri, commit.sha]));
items.push(new CommandQuickPickItem({
@ -86,7 +86,7 @@ export class CommitFileDetailsQuickPick {
items.push(new CommandQuickPickItem({
label: `$(history) Show ${workingFileName && options.showFileHistory ? 'Previous ' : ''}File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)} \u00a0\u2022\u00a0 starting from \u00a0$(git-commit) ${commit.sha}`
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)} \u00a0\u2022\u00a0 starting from \u00a0$(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickFileHistory, [new GitUri(commit.uri, commit), undefined, currentCommand]));
if (goBackCommand) {
@ -97,7 +97,7 @@ export class CommitFileDetailsQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: `${commit.getFormattedPath()} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
placeHolder: `${commit.getFormattedPath()} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
Keyboard.instance.setKeyCommand('right', item);

+ 1
- 1
src/quickPicks/fileHistory.ts Wyświetl plik

@ -48,7 +48,7 @@ export class FileHistoryQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${commit.getFormattedPath()}${sha ? ` \u00a0\u2022\u00a0 ${sha}` : ''}`,
placeHolder: `${commit.getFormattedPath()}${sha ? ` \u00a0\u2022\u00a0 ${sha.substring(0, 8)}` : ''}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
Keyboard.instance.setKeyCommand('right', item);

+ 3
- 1
src/quickPicks/gitQuickPicks.ts Wyświetl plik

@ -13,7 +13,7 @@ export class CommitQuickPickItem implements QuickPickItem {
constructor(public commit: GitCommit, descriptionSuffix: string = '') {
this.label = `${commit.author}, ${moment(commit.date).fromNow()}`;
this.description = `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha}${descriptionSuffix}`;
this.description = `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}${descriptionSuffix}`;
this.detail = commit.message;
}
}
@ -23,6 +23,7 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
fileName: string;
gitUri: GitUri;
sha: string;
shortSha: string;
status: GitFileStatus;
constructor(commit: GitCommit, fileName: string, status: GitFileStatus) {
@ -41,6 +42,7 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
this.fileName = fileName;
this.gitUri = new GitUri(Uri.file(path.resolve(commit.repoPath, fileName)));
this.sha = commit.sha;
this.shortSha = commit.shortSha;
this.status = status;
}
}

Ładowanie…
Anuluj
Zapisz