diff --git a/src/commands/showCommitSearch.ts b/src/commands/showCommitSearch.ts index e367f62..9185803 100644 --- a/src/commands/showCommitSearch.ts +++ b/src/commands/showCommitSearch.ts @@ -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([ ['@', 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}'`; diff --git a/src/gitService.ts b/src/gitService.ts index 62b0735..a70ef64 100644 --- a/src/gitService.ts +++ b/src/gitService.ts @@ -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;