Explorar el Código

Fixes #730 - removes -S support from commit search

Causes too much confusion vs -G which better matches user expectations
main
Eric Amodio hace 5 años
padre
commit
3e8603b93f
Se han modificado 6 ficheros con 13 adiciones y 43 borrados
  1. +5
    -6
      README.md
  2. +1
    -1
      src/commands/diffDirectory.ts
  3. +1
    -1
      src/commands/externalDiff.ts
  4. +4
    -10
      src/commands/searchCommits.ts
  5. +1
    -13
      src/git/gitService.ts
  6. +1
    -12
      src/views/nodes/searchNode.ts

+ 5
- 6
README.md Ver fichero

@ -409,12 +409,11 @@ A [customizable](#search-commits-view-settings- 'Jump to the Search Commits view
- A toolbar provides quick access to the _Search Commits_, _Keep Results_, _Clear Results_, and _Refresh_ commands
- A context menu provides _Automatic Layout_, _List Layout_, _Tree Layout_, _Open Settings_ commands
- 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#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')
- 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#Documentation/git-log.txt---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#Documentation/git-log.txt---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#Documentation/git-log.txt-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#Documentation/git-log.txt---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#Documentation/git-log.txt--Gltregexgt 'Open Git docs')
The search commits view provides the following features,

+ 1
- 1
src/commands/diffDirectory.ts Ver fichero

@ -97,7 +97,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
return commands.executeCommand(
BuiltInCommands.Open,
Uri.parse('https://git-scm.com/docs/git-config#git-config-difftool')
Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
);
}

+ 1
- 1
src/commands/externalDiff.ts Ver fichero

@ -197,7 +197,7 @@ export class ExternalDiffCommand extends Command {
return commands.executeCommand(
BuiltInCommands.Open,
Uri.parse('https://git-scm.com/docs/git-config#git-config-difftool')
Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
);
}

+ 4
- 10
src/commands/searchCommits.ts Ver fichero

@ -19,19 +19,17 @@ import {
} from './common';
import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails';
const searchByRegex = /^([@~=:#])/;
const searchByRegex = /^([@~:#])/;
const symbolToSearchByMap = new Map<string, GitRepoSearchBy>([
['@', GitRepoSearchBy.Author],
['~', GitRepoSearchBy.ChangedLines],
['=', GitRepoSearchBy.Changes],
['~', GitRepoSearchBy.Changes],
[':', GitRepoSearchBy.Files],
['#', GitRepoSearchBy.Sha]
]);
const searchByToSymbolMap = new Map<GitRepoSearchBy, string>([
[GitRepoSearchBy.Author, '@'],
[GitRepoSearchBy.ChangedLines, '~'],
[GitRepoSearchBy.Changes, '='],
[GitRepoSearchBy.Changes, '~'],
[GitRepoSearchBy.Files, ':'],
[GitRepoSearchBy.Sha, '#']
]);
@ -120,7 +118,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
value: args.search,
prompt: 'Please enter a search string',
placeHolder:
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), changes (=<pattern>), changed lines (~<pattern>)',
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)',
valueSelection: selection
};
args.search = await window.showInputBox(opts);
@ -153,10 +151,6 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
searchLabel = `commits with an author matching '${args.search}'`;
break;
case GitRepoSearchBy.ChangedLines:
searchLabel = `commits with changed lines matching '${args.search}'`;
break;
case GitRepoSearchBy.Changes:
searchLabel = `commits with changes matching '${args.search}'`;
break;

+ 1
- 13
src/git/gitService.ts Ver fichero

@ -87,7 +87,6 @@ const mappedAuthorRegex = /(.+)\s<(.+)>/;
export enum GitRepoSearchBy {
Author = 'author',
ChangedLines = 'changed-lines',
Changes = 'changes',
Files = 'files',
Message = 'message',
@ -1319,16 +1318,6 @@ export class GitService implements Disposable {
`--author=${search}`
];
break;
case GitRepoSearchBy.ChangedLines:
searchArgs = [
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
'--all',
'--full-history',
'-E',
'-i',
`-G${search}`
];
break;
case GitRepoSearchBy.Changes:
searchArgs = [
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
@ -1336,8 +1325,7 @@ export class GitService implements Disposable {
'--full-history',
'-E',
'-i',
'--pickaxe-regex',
`-S${search}`
`-G${search}`
];
break;
case GitRepoSearchBy.Files:

+ 1
- 12
src/views/nodes/searchNode.ts Ver fichero

@ -81,19 +81,8 @@ export class SearchNode extends ViewNode {
arguments: [this, getCommandArgs(GitRepoSearchBy.Changes)]
},
`${GlyphChars.Space.repeat(4)} or, by changes`,
'= pattern',
'Click to search commits by changes'
),
new CommandMessageNode(
this.view,
this,
{
...command,
arguments: [this, getCommandArgs(GitRepoSearchBy.ChangedLines)]
},
`${GlyphChars.Space.repeat(4)} or, by changed lines`,
'~ pattern',
'Click to search commits by changed lines'
'Click to search commits by changes'
)
];
}

Cargando…
Cancelar
Guardar