Parcourir la source

Adds Git extended regex support to commit searches

Changes commit search by message to be case-insensitive
Clarifies path/glob for file searches
main
Eric Amodio il y a 6 ans
Parent
révision
a8cbe0188e
5 fichiers modifiés avec 11 ajouts et 9 suppressions
  1. +2
    -0
      CHANGELOG.md
  2. +2
    -2
      README.md
  3. +1
    -1
      src/commands/searchCommits.ts
  4. +5
    -5
      src/git/gitService.ts
  5. +1
    -1
      src/views/nodes/searchNode.ts

+ 2
- 0
CHANGELOG.md Voir le fichier

@ -9,11 +9,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added
- Adds control over the contributed menu commands to the Source Control side bar to the GitLens interactive settings editor (via the `gitlens.menus` setting)
- Adds Git extended regex support to commit searches
### Changed
- Changes the _Show Revision Details_ command (`gitlens.showQuickRevisionDetails`) to show file commit details
- Changes the `alt`-command of the _Toggle File Blame Annotations_ command (`gitlens.toggleFileBlame`) to _Toggle File Heatmap Annotations_ command (`gitlens.toggleFileHeatmap`)
- Changes searching for commits by message to be case-insensitive
- Reworks the layout of some contributed menu command
### Fixed

+ 2
- 2
README.md Voir le fichier

@ -430,8 +430,8 @@ A [customizable](#search-commits-view-settings- 'Jump to the Search Commits view
- Use the _Search Commits_ command (`gitlens.showCommitSearch`) with a shortcut of `alt+/` to search for commits
- by message &mdash; use `<message>` to search for commits with messages that match `<message>` &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log---grepltpatterngt 'Open Git docs')
- or, by author &mdash; use `@<pattern>` to search for commits with authors that match `<pattern>` &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log---authorltpatterngt 'Open Git docs')
- or, by commit id &mdash; use `#<sha>` to search for a commit with id of `<sha>` &mdash; See [Git docs](https://git-scm.com/docs/git-log 'Open Git docs')
- or, by files &mdash; use `:<pattern>` to search for commits with file names that match `<pattern>` &mdash; See [Git docs](https://git-scm.com/docs/git-log 'Open Git docs')
- or, by commit id &mdash; use `#<sha>` to search for a commit with id of `<sha>` &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log-ltrevisionrangegt 'Open Git docs')
- or, by files &mdash; use `:<path/glob>` to search for commits with file names that match `<path/glob>` &mdash; See [Git docs](https://git-scm.com/docs/git-log---ltpathgt82308203 'Open Git docs')
- or, by changes &mdash; use `~<pattern>` to search for commits with differences whose patch text contains added/removed lines that match `<pattern>` &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log--Gltregexgt 'Open Git docs')
- or, by changed lines &mdash; use `=<string>` to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log--Sltstringgt 'Open Git docs')

+ 1
- 1
src/commands/searchCommits.ts Voir le fichier

@ -100,7 +100,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
args.search = await window.showInputBox({
value: args.search,
prompt: `Please enter a search string`,
placeHolder: `Search commits by message, author (@<pattern>), files (:<pattern>), commit id (#<sha>), changes (=<pattern>), changed lines (~<pattern>)`,
placeHolder: `Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), changes (=<pattern>), changed lines (~<pattern>)`,
valueSelection: selection
} as InputBoxOptions);
if (args.search === undefined) {

+ 5
- 5
src/git/gitService.ts Voir le fichier

@ -1374,19 +1374,19 @@ export class GitService implements Disposable {
let searchArgs: string[] | undefined = undefined;
switch (searchBy) {
case GitRepoSearchBy.Author:
searchArgs = ['-m', '-M', '--all', '--full-history', '-i', `--author=${search}`];
searchArgs = ['-m', '-M', '--all', '--full-history', '-E', '-i', `--author=${search}`];
break;
case GitRepoSearchBy.ChangedLines:
searchArgs = ['-M', '--all', '--full-history', '-i', `-G${search}`];
searchArgs = ['-M', '--all', '--full-history', '-E', '-i', `-G${search}`];
break;
case GitRepoSearchBy.Changes:
searchArgs = ['-M', '--all', '--full-history', '-i', '--pickaxe-regex', `-S${search}`];
searchArgs = ['-M', '--all', '--full-history', '-E', '-i', '--pickaxe-regex', `-S${search}`];
break;
case GitRepoSearchBy.Files:
searchArgs = ['-M', '--all', '--full-history', '-i', `--`, `${search}`];
searchArgs = ['-M', '--all', '--full-history', '-E', '-i', `--`, `${search}`];
break;
case GitRepoSearchBy.Message:
searchArgs = ['-m', '-M', '--all', '--full-history'];
searchArgs = ['-m', '-M', '--all', '--full-history', '-E', '-i'];
if (search) {
searchArgs.push(`--grep=${search}`);
}

+ 1
- 1
src/views/nodes/searchNode.ts Voir le fichier

@ -60,7 +60,7 @@ export class SearchNode extends ViewNode {
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Files } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by files (use :&lt;file-pattern&gt;)`,
`${GlyphChars.Space.repeat(4)} or, by files (use :&lt;file-path/glob&gt;)`,
'Click to search commits by files'
),
new CommandMessageNode(

Chargement…
Annuler
Enregistrer