Преглед на файлове

Prepopulates commit search to the current line commit

If there is an active editor, otherwise will fall back to the clipboard
main
Eric Amodio преди 7 години
родител
ревизия
49cc681520
променени са 1 файла, в които са добавени 19 реда и са изтрити 4 реда
  1. +19
    -4
      src/commands/showCommitSearch.ts

+ 19
- 4
src/commands/showCommitSearch.ts Целия файл

@ -36,10 +36,25 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
if (!repoPath) return window.showWarningMessage(`Unable to show commit search`);
if (!args.search || args.searchBy == null) {
if (!args.search) {
args.search = await new Promise<string>((resolve, reject) => {
paste((err: Error, content: string) => resolve(err ? '' : content));
});
try {
if (!args.search) {
if (editor !== undefined && gitUri !== undefined) {
const line = editor.selection.active.line - gitUri.offset;
const blameLine = await this.git.getBlameForLine(gitUri, line);
if (blameLine !== undefined) {
args.search = `#${blameLine.commit.shortSha}`;
}
}
if (!args.search) {
args.search = await new Promise<string>((resolve, reject) => {
paste((err: Error, content: string) => resolve(err ? '' : content));
});
}
}
}
catch (ex) {
Logger.error(ex, 'ShowCommitSearchCommand', 'search prefetch failed');
}
args.search = await window.showInputBox({

Зареждане…
Отказ
Запис