Browse Source

Fixes #2231 adds stash searching

main
Eric Amodio 2 years ago
parent
commit
643a1e04a3
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      src/env/node/git/localGitProvider.ts

+ 12
- 2
src/env/node/git/localGitProvider.ts View File

@ -1640,7 +1640,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
let stdin: string | undefined; let stdin: string | undefined;
// TODO@eamodio this is insanity -- there *HAS* to be a better way to get git log to return stashes // TODO@eamodio this is insanity -- there *HAS* to be a better way to get git log to return stashes
const stash = getSettledValue(stashResult); const stash = getSettledValue(stashResult);
if (stash != null) {
if (stash != null && stash.commits.size !== 0) {
stdin = join( stdin = join(
map(stash.commits.values(), c => c.sha.substring(0, 9)), map(stash.commits.values(), c => c.sha.substring(0, 9)),
'\n', '\n',
@ -4152,6 +4152,16 @@ export class LocalGitProvider implements GitProvider, Disposable {
const limit = options?.limit ?? configuration.get('advanced.maxSearchItems') ?? 0; const limit = options?.limit ?? configuration.get('advanced.maxSearchItems') ?? 0;
const similarityThreshold = configuration.get('advanced.similarityThreshold'); const similarityThreshold = configuration.get('advanced.similarityThreshold');
const stash = await this.getStash(repoPath);
let stdin: string | undefined;
// TODO@eamodio this is insanity -- there *HAS* to be a better way to get git log to return stashes
if (stash != null && stash.commits.size !== 0) {
stdin = join(
map(stash.commits.values(), c => c.sha.substring(0, 9)),
'\n',
);
}
const args = [ const args = [
...refAndDateParser.arguments, ...refAndDateParser.arguments,
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`, `-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
@ -4179,7 +4189,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
const data = await this.git.log2( const data = await this.git.log2(
repoPath, repoPath,
{ cancellation: options?.cancellation },
{ cancellation: options?.cancellation, stdin: stdin },
...args, ...args,
...(cursor?.skip ? [`--skip=${cursor.skip}`] : []), ...(cursor?.skip ? [`--skip=${cursor.skip}`] : []),
...(limit ? [`-n${limit + 1}`] : []), ...(limit ? [`-n${limit + 1}`] : []),

Loading…
Cancel
Save