Sfoglia il codice sorgente

Adds more commit search support for #127

Adds ~ to search for changes
Adds = to search for changes with new occurrences only
main
Eric Amodio 7 anni fa
parent
commit
74429a4748
2 ha cambiato i file con 21 aggiunte e 1 eliminazioni
  1. +13
    -1
      src/commands/showCommitSearch.ts
  2. +8
    -0
      src/gitService.ts

+ 13
- 1
src/commands/showCommitSearch.ts Vedi File

@ -9,9 +9,11 @@ import { Messages } from '../messages';
import { CommandQuickPickItem, CommitsQuickPick } from '../quickPicks';
import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails';
const searchByRegex = /^([@:#])/;
const searchByRegex = /^([@~=:#])/;
const searchByMap = new Map<string, GitRepoSearchBy>([
['@', GitRepoSearchBy.Author],
['~', GitRepoSearchBy.Changes],
['=', GitRepoSearchBy.ChangesOccurrences],
[':', GitRepoSearchBy.Files],
['#', GitRepoSearchBy.Sha]
]);
@ -85,6 +87,16 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
placeHolder = `commits with author matching '${args.search}'`;
break;
case GitRepoSearchBy.Changes:
originalSearch = `~${args.search}`;
placeHolder = `commits with changes matching '${args.search}'`;
break;
case GitRepoSearchBy.ChangesOccurrences:
originalSearch = `=${args.search}`;
placeHolder = `commits with changes (new occurrences) matching '${args.search}'`;
break;
case GitRepoSearchBy.Files:
originalSearch = `:${args.search}`;
placeHolder = `commits with files matching '${args.search}'`;

+ 8
- 0
src/gitService.ts Vedi File

@ -58,6 +58,8 @@ enum RemoveCacheReason {
export enum GitRepoSearchBy {
Author = 'author',
Changes = 'changes',
ChangesOccurrences = 'changes-occurrences',
Files = 'files',
Message = 'message',
Sha = 'sha'
@ -801,6 +803,12 @@ export class GitService extends Disposable {
case GitRepoSearchBy.Author:
searchArgs = [`--author=${search}`];
break;
case GitRepoSearchBy.Changes:
searchArgs = [`-G${search}`];
break;
case GitRepoSearchBy.ChangesOccurrences:
searchArgs = [`-S${search}`, '--pickaxe-regex'];
break;
case GitRepoSearchBy.Files:
searchArgs = [`--`, `${search}`];
break;

Caricamento…
Annulla
Salva