Skip to content

Commit 3e8603b

Browse files
committed
Fixes #730 - removes -S support from commit search
Causes too much confusion vs -G which better matches user expectations
1 parent 643e226 commit 3e8603b

File tree

6 files changed

+13
-43
lines changed

6 files changed

+13
-43
lines changed

Diff for: README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,11 @@ A [customizable](#search-commits-view-settings- 'Jump to the Search Commits view
409409
- A toolbar provides quick access to the _Search Commits_, _Keep Results_, _Clear Results_, and _Refresh_ commands
410410
- A context menu provides _Automatic Layout_, _List Layout_, _Tree Layout_, _Open Settings_ commands
411411
- Use the _Search Commits_ command (`gitlens.showCommitSearch`) with a shortcut of `alt+/` to search for commits
412-
- 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')
413-
- 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')
414-
- 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')
415-
- 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')
416-
- 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')
417-
- 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')
412+
- 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')
413+
- 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')
414+
- 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')
415+
- 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')
416+
- 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')
418417

419418
The search commits view provides the following features,
420419

Diff for: src/commands/diffDirectory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
9797

9898
return commands.executeCommand(
9999
BuiltInCommands.Open,
100-
Uri.parse('https://git-scm.com/docs/git-config#git-config-difftool')
100+
Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
101101
);
102102
}
103103

Diff for: src/commands/externalDiff.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class ExternalDiffCommand extends Command {
197197

198198
return commands.executeCommand(
199199
BuiltInCommands.Open,
200-
Uri.parse('https://git-scm.com/docs/git-config#git-config-difftool')
200+
Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
201201
);
202202
}
203203

Diff for: src/commands/searchCommits.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@ import {
1919
} from './common';
2020
import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails';
2121

22-
const searchByRegex = /^([@~=:#])/;
22+
const searchByRegex = /^([@~:#])/;
2323
const symbolToSearchByMap = new Map<string, GitRepoSearchBy>([
2424
['@', GitRepoSearchBy.Author],
25-
['~', GitRepoSearchBy.ChangedLines],
26-
['=', GitRepoSearchBy.Changes],
25+
['~', GitRepoSearchBy.Changes],
2726
[':', GitRepoSearchBy.Files],
2827
['#', GitRepoSearchBy.Sha]
2928
]);
3029

3130
const searchByToSymbolMap = new Map<GitRepoSearchBy, string>([
3231
[GitRepoSearchBy.Author, '@'],
33-
[GitRepoSearchBy.ChangedLines, '~'],
34-
[GitRepoSearchBy.Changes, '='],
32+
[GitRepoSearchBy.Changes, '~'],
3533
[GitRepoSearchBy.Files, ':'],
3634
[GitRepoSearchBy.Sha, '#']
3735
]);
@@ -120,7 +118,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
120118
value: args.search,
121119
prompt: 'Please enter a search string',
122120
placeHolder:
123-
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), changes (=<pattern>), changed lines (~<pattern>)',
121+
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)',
124122
valueSelection: selection
125123
};
126124
args.search = await window.showInputBox(opts);
@@ -153,10 +151,6 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
153151
searchLabel = `commits with an author matching '${args.search}'`;
154152
break;
155153

156-
case GitRepoSearchBy.ChangedLines:
157-
searchLabel = `commits with changed lines matching '${args.search}'`;
158-
break;
159-
160154
case GitRepoSearchBy.Changes:
161155
searchLabel = `commits with changes matching '${args.search}'`;
162156
break;

Diff for: src/git/gitService.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ const mappedAuthorRegex = /(.+)\s<(.+)>/;
8787

8888
export enum GitRepoSearchBy {
8989
Author = 'author',
90-
ChangedLines = 'changed-lines',
9190
Changes = 'changes',
9291
Files = 'files',
9392
Message = 'message',
@@ -1319,25 +1318,14 @@ export class GitService implements Disposable {
13191318
`--author=${search}`
13201319
];
13211320
break;
1322-
case GitRepoSearchBy.ChangedLines:
1323-
searchArgs = [
1324-
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
1325-
'--all',
1326-
'--full-history',
1327-
'-E',
1328-
'-i',
1329-
`-G${search}`
1330-
];
1331-
break;
13321321
case GitRepoSearchBy.Changes:
13331322
searchArgs = [
13341323
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
13351324
'--all',
13361325
'--full-history',
13371326
'-E',
13381327
'-i',
1339-
'--pickaxe-regex',
1340-
`-S${search}`
1328+
`-G${search}`
13411329
];
13421330
break;
13431331
case GitRepoSearchBy.Files:

Diff for: src/views/nodes/searchNode.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,8 @@ export class SearchNode extends ViewNode {
8181
arguments: [this, getCommandArgs(GitRepoSearchBy.Changes)]
8282
},
8383
`${GlyphChars.Space.repeat(4)} or, by changes`,
84-
'= pattern',
85-
'Click to search commits by changes'
86-
),
87-
new CommandMessageNode(
88-
this.view,
89-
this,
90-
{
91-
...command,
92-
arguments: [this, getCommandArgs(GitRepoSearchBy.ChangedLines)]
93-
},
94-
`${GlyphChars.Space.repeat(4)} or, by changed lines`,
9584
'~ pattern',
96-
'Click to search commits by changed lines'
85+
'Click to search commits by changes'
9786
)
9887
];
9988
}

0 commit comments

Comments
 (0)