@gitkraken/core-gitlens 0.57.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/dist/git/context.d.ts +1 -0
- package/dist/git/context.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +1 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/graph.d.ts +2 -1
- package/dist/git/models/graph.js.map +1 -1
- package/dist/git/models/graphSession.d.ts +8 -0
- package/dist/git/models/graphSession.js.map +1 -1
- package/dist/git/parsers/diffParser.js +1 -1
- package/dist/git/utils/hiddenRefs.utils.d.ts +26 -0
- package/dist/git/utils/hiddenRefs.utils.js +89 -0
- package/dist/git/utils/hiddenRefs.utils.js.map +1 -0
- package/dist/git/utils/search.utils.d.ts +3 -1
- package/dist/git/utils/search.utils.js +3 -1
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git-cli/exec/git.js +2 -1
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/locator.d.ts +2 -1
- package/dist/git-cli/exec/locator.js +11 -3
- package/dist/git-cli/exec/locator.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.js +1 -1
- package/dist/git-cli/parsers/indexParser.js +1 -1
- package/dist/git-cli/parsers/statusParser.js +1 -1
- package/dist/git-cli/providers/branches.js +1 -1
- package/dist/git-cli/providers/commits.js +3 -2
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +11 -1
- package/dist/git-cli/providers/graph.js +156 -38
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/refs.js +1 -1
- package/dist/git-cli/providers/tags.js +1 -1
- package/dist/git-cli/service.js +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +4 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +8 -2
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +2 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +2 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +16 -12
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -1
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +5 -0
- package/dist/plus/integrations/integrationService.js +89 -8
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +8 -0
- package/dist/plus/integrations/models/azurePullRequestWrites.d.ts +3 -1
- package/dist/plus/integrations/models/bitbucketServerPullRequestWrites.d.ts +142 -0
- package/dist/plus/integrations/models/bitbucketServerPullRequestWrites.js +0 -0
- package/dist/plus/integrations/models/integration.d.ts +7 -4
- package/dist/plus/integrations/models/integration.js +12 -11
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +12 -3
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.d.ts +6 -2
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js +44 -10
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js.map +1 -1
- package/dist/plus/integrations/providers/azurePullRequestWrites.d.ts +1 -0
- package/dist/plus/integrations/providers/azurePullRequestWrites.js +28 -13
- package/dist/plus/integrations/providers/azurePullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +4 -1
- package/dist/plus/integrations/providers/bitbucket-server.js +23 -0
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js +2 -2
- package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.d.ts +22 -0
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.js +94 -0
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.d.ts +51 -0
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.js +593 -0
- package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.js.map +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +10 -0
- package/dist/plus/integrations/providers/jira-server.js +16 -1
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +6 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +60 -11
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.js +8 -3
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +13 -0
- package/dist/plus/integrations/providers/providersApi.js +58 -1
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/writeInputs.d.ts +1 -0
- package/dist/plus/integrations/providers/utils/writeInputs.js +4 -1
- package/dist/plus/integrations/providers/utils/writeInputs.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -1
- package/dist/plus/integrations/reads/currentAccount.js +1 -1
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +4 -1
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/docs/integrations.md +121 -5
- package/docs/kepler-read-api-parity.md +2 -1
- package/package.json +1 -1
|
@@ -119,7 +119,7 @@ function parseSearchQuery(search, validate = false) {
|
|
|
119
119
|
...operatorRanges?.length && { operatorRanges }
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function parseSearchQueryGitCommand(search, currentUser) {
|
|
122
|
+
function parseSearchQueryGitCommand(search, currentUser, options) {
|
|
123
123
|
const { operations } = parseSearchQuery(search);
|
|
124
124
|
const searchArgs = /* @__PURE__ */ new Set();
|
|
125
125
|
const files = [];
|
|
@@ -142,6 +142,7 @@ function parseSearchQueryGitCommand(search, currentUser) {
|
|
|
142
142
|
}
|
|
143
143
|
shas = searchArgs;
|
|
144
144
|
} else {
|
|
145
|
+
for (const exclude of options?.hiddenRefExcludes ?? []) searchArgs.add(exclude);
|
|
145
146
|
searchArgs.add("--all");
|
|
146
147
|
for ([op, values] of operations.entries()) switch (op) {
|
|
147
148
|
case "message:":
|
|
@@ -272,6 +273,7 @@ function parseSearchQueryGitCommand(search, currentUser) {
|
|
|
272
273
|
if (value.startsWith("-")) continue;
|
|
273
274
|
filters.refs = true;
|
|
274
275
|
searchArgs.delete("--all");
|
|
276
|
+
for (const exclude of options?.hiddenRefExcludes ?? []) searchArgs.delete(exclude);
|
|
275
277
|
searchArgs.add(value);
|
|
276
278
|
}
|
|
277
279
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.utils.js","names":[],"sources":["../../../../git/src/utils/search.utils.ts"],"sourcesContent":["import { some } from '@gitlens/utils/iterable.js';\nimport type { GitRevisionReference } from '../models/reference.js';\nimport type {\n\tGitCommitSearchContext,\n\tHighlightableOperator,\n\tParsedSearchQuery,\n\tSearchOperators,\n\tSearchOperatorsLongForm,\n\tSearchQuery,\n\tSearchQueryFilters,\n\tSearchQueryGitCommand,\n\tSearchQueryGitHubCommand,\n} from '../models/search.js';\nimport { searchOperators, searchOperatorsToLongFormMap } from '../models/search.js';\nimport type { GitUser } from '../models/user.js';\nimport { isSha, shortenRevision } from './revision.utils.js';\n\nexport function getSearchQueryComparisonKey(search: SearchQuery): string {\n\treturn `${search.query}|${search.matchAll ? 'A' : ''}${search.matchCase ? 'C' : ''}${\n\t\tsearch.matchRegex ? 'R' : ''\n\t}${search.matchWholeWord ? 'W' : ''}${search.naturalLanguage ? 'NL' : ''}`;\n}\n\nexport function createSearchQueryForCommit(ref: string): string;\nexport function createSearchQueryForCommit(commit: GitRevisionReference): string;\nexport function createSearchQueryForCommit(refOrCommit: string | GitRevisionReference): string {\n\treturn `#:${typeof refOrCommit === 'string' ? shortenRevision(refOrCommit) : refOrCommit.name}`;\n}\n\nexport function createSearchQueryForCommits(refs: string[]): string;\nexport function createSearchQueryForCommits(commits: GitRevisionReference[]): string;\nexport function createSearchQueryForCommits(refsOrCommits: (string | GitRevisionReference)[]): string {\n\treturn refsOrCommits.map(r => `#:${typeof r === 'string' ? shortenRevision(r) : r.name}`).join(' ');\n}\n\nexport function rebuildSearchQueryFromParsed(parsed: ParsedSearchQuery): string {\n\tconst parts: string[] = [];\n\n\tfor (const [operator, values] of parsed.operations) {\n\t\tfor (const value of values) {\n\t\t\tparts.push(`${operator}${value}`);\n\t\t}\n\t}\n\n\treturn parts.join(' ');\n}\n\nexport function parseSearchQuery(search: SearchQuery, validate: boolean = false): ParsedSearchQuery {\n\tconst operations = new Map<SearchOperatorsLongForm, Set<string>>();\n\tconst query = search.query.trim();\n\n\tlet errors: string[] | undefined;\n\tlet operatorRanges: Array<{ start: number; end: number; operator: HighlightableOperator }> | undefined;\n\tlet pos = 0;\n\n\twhile (pos < query.length) {\n\t\t// Skip whitespace\n\t\tif (/\\s/.test(query[pos])) {\n\t\t\tpos++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Try to match an operator\n\t\tlet matchedOperator = false;\n\t\tlet op: SearchOperators | undefined;\n\t\tlet value: string | undefined;\n\n\t\t// Check for operators (starting with longer ones first to avoid partial matches)\n\t\tfor (const operator of searchOperators) {\n\t\t\tif (!operator.length) continue;\n\n\t\t\tif (query.startsWith(operator, pos)) {\n\t\t\t\top = operator as SearchOperators;\n\t\t\t\tconst operatorStart = pos;\n\t\t\t\tconst startPos = pos + operator.length;\n\t\t\t\tpos = startPos;\n\n\t\t\t\t// Track operator position\n\t\t\t\toperatorRanges ??= [];\n\t\t\t\toperatorRanges.push({\n\t\t\t\t\tstart: operatorStart,\n\t\t\t\t\tend: startPos,\n\t\t\t\t\toperator: op,\n\t\t\t\t});\n\n\t\t\t\t// Skip optional space after operator\n\t\t\t\tif (query[pos] === ' ') {\n\t\t\t\t\tpos++;\n\t\t\t\t}\n\n\t\t\t\t// Extract the value and check if it is quoted\n\t\t\t\tif (query[pos] === '\"') {\n\t\t\t\t\tconst endQuotePos = query.indexOf('\"', pos + 1);\n\t\t\t\t\tif (endQuotePos !== -1) {\n\t\t\t\t\t\tvalue = query.substring(pos, endQuotePos + 1);\n\t\t\t\t\t\tpos = endQuotePos + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Unterminated quote, take the rest of the string\n\t\t\t\t\t\tvalue = query.substring(pos);\n\t\t\t\t\t\tpos = query.length;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Unquoted value - take until whitespace\n\t\t\t\t\tconst nextSpacePos = query.indexOf(' ', pos);\n\t\t\t\t\tconst valueEndPos = nextSpacePos !== -1 ? nextSpacePos : query.length;\n\t\t\t\t\tvalue = query.substring(pos, valueEndPos);\n\t\t\t\t\tpos = valueEndPos;\n\t\t\t\t}\n\n\t\t\t\tmatchedOperator = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!matchedOperator) {\n\t\t\t// No operator found, parse as text\n\t\t\tconst textStart = pos;\n\t\t\tlet text: string;\n\n\t\t\t// Check if text is quoted\n\t\t\tif (query[pos] === '\"') {\n\t\t\t\tconst endQuotePos = query.indexOf('\"', pos + 1);\n\t\t\t\tif (endQuotePos !== -1) {\n\t\t\t\t\ttext = query.substring(pos, endQuotePos + 1);\n\t\t\t\t\tpos = endQuotePos + 1;\n\t\t\t\t} else {\n\t\t\t\t\t// Unterminated quote, take the rest of the string\n\t\t\t\t\ttext = query.substring(pos);\n\t\t\t\t\tpos = query.length;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Unquoted text - take until whitespace\n\t\t\t\tconst nextSpacePos = query.indexOf(' ', pos);\n\t\t\t\tconst valueEndPos = nextSpacePos !== -1 ? nextSpacePos : query.length;\n\t\t\t\ttext = query.substring(pos, valueEndPos);\n\t\t\t\tpos = valueEndPos;\n\t\t\t}\n\n\t\t\t// Handle special text tokens (@me, SHA)\n\t\t\tif (text === '@me') {\n\t\t\t\top = 'author:';\n\t\t\t\t// Track @me position for highlighting\n\t\t\t\toperatorRanges ??= [];\n\t\t\t\toperatorRanges.push({\n\t\t\t\t\tstart: textStart,\n\t\t\t\t\tend: textStart + text.length,\n\t\t\t\t\toperator: '@me',\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\top = isSha(text) ? 'commit:' : 'message:';\n\t\t\t}\n\t\t\tvalue = text;\n\t\t}\n\n\t\t// Validate operator has a value\n\t\tif (op && !value) {\n\t\t\tif (!validate) continue;\n\n\t\t\terrors ??= [];\n\t\t\terrors.push(`'${op}' requires a value`);\n\t\t}\n\n\t\t// Add the discovered operation to our map\n\t\tif (op && value) {\n\t\t\tconst longFormOp = searchOperatorsToLongFormMap.get(op);\n\t\t\tif (longFormOp) {\n\t\t\t\tlet values = operations.get(longFormOp);\n\t\t\t\tif (values == null) {\n\t\t\t\t\tvalues = new Set();\n\t\t\t\t\toperations.set(longFormOp, values);\n\t\t\t\t}\n\t\t\t\tvalues.add(value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (validate && operations.get('message:')?.size && operations.get('-message:')?.size) {\n\t\terrors ??= [];\n\t\terrors.push(\"Cannot combine 'message:' and '-message:' in the same query\");\n\t}\n\n\treturn {\n\t\toperations: operations,\n\t\t...(errors?.length && { errors: errors }),\n\t\t...(operatorRanges?.length && { operatorRanges: operatorRanges }),\n\t};\n}\n\nexport function parseSearchQueryGitCommand(\n\tsearch: SearchQuery,\n\tcurrentUser: GitUser | undefined,\n): SearchQueryGitCommand {\n\tconst { operations } = parseSearchQuery(search);\n\n\tconst searchArgs = new Set<string>();\n\tconst files: string[] = [];\n\tlet shas;\n\tconst filters: SearchQueryFilters = { files: false, type: undefined, refs: false };\n\n\tlet op;\n\tlet values = operations.get('commit:');\n\tif (values != null) {\n\t\tfor (let value of values) {\n\t\t\tif (!value) continue;\n\n\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\tif (!value) continue;\n\t\t\t}\n\n\t\t\tsearchArgs.add(value);\n\t\t}\n\t\tshas = searchArgs;\n\t} else {\n\t\tsearchArgs.add('--all');\n\n\t\tfor ([op, values] of operations.entries()) {\n\t\t\tswitch (op) {\n\t\t\t\tcase 'message:':\n\t\t\t\t\tif (search.matchAll) {\n\t\t\t\t\t\tsearchArgs.add('--all-match');\n\t\t\t\t\t}\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--grep=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '-message:': {\n\t\t\t\t\t// --invert-grep flips ALL --grep patterns in the command, so a query mixing positive\n\t\t\t\t\t// message: terms with negative -message: terms can't be represented in one git invocation.\n\t\t\t\t\t// parseSearchQuery's validate path rejects that combination up front; this is a defensive\n\t\t\t\t\t// fallback for callers that skip validation -- drop the excluded terms rather than\n\t\t\t\t\t// silently inverting the positive matches.\n\t\t\t\t\tif (operations.get('message:')?.size) break;\n\n\t\t\t\t\tlet hasValue = false;\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--grep=${value}`);\n\t\t\t\t\t\thasValue = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (hasValue) {\n\t\t\t\t\t\tsearchArgs.add('--invert-grep');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'author:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\t\tif (!currentUser?.name) continue;\n\n\t\t\t\t\t\t\tvalue = currentUser.name;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\t\tvalue = value.slice(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--author=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'committer:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\t\tif (!currentUser?.name) continue;\n\n\t\t\t\t\t\t\tvalue = currentUser.name;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\t\tvalue = value.slice(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--committer=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'type:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === 'stash') {\n\t\t\t\t\t\t\tfilters.type = 'stash';\n\t\t\t\t\t\t\tsearchArgs.add('--no-walk');\n\t\t\t\t\t\t} else if (value === 'tip') {\n\t\t\t\t\t\t\tfilters.type = 'tip';\n\t\t\t\t\t\t} else if (value === 'wip') {\n\t\t\t\t\t\t\tfilters.type = 'wip';\n\t\t\t\t\t\t} else if (value === 'merge') {\n\t\t\t\t\t\t\tfilters.type = 'merge';\n\t\t\t\t\t\t\tsearchArgs.add('--merges');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'file:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\t\tfilters.files = true;\n\t\t\t\t\t\t\tfiles.push(value);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfilters.files = true;\n\n\t\t\t\t\t\t\tconst prefix = search.matchCase ? '' : ':(icase)';\n\t\t\t\t\t\t\tif (value.includes('**')) {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}:(glob)${value}`);\n\t\t\t\t\t\t\t} else if (/[./\\\\*?|![\\]{}]/.test(value)) {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}${value}`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}*${value}*`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'change:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfilters.files = true;\n\t\t\t\t\t\tsearchArgs.add(search.matchRegex ? `-G${value}` : `-S${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'after:':\n\t\t\t\tcase 'before:': {\n\t\t\t\t\tconst flag = op === 'after:' ? '--since' : '--until';\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`${flag}=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'ref:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// A value starting with `-` would be consumed by git as an option rather than a ref\n\t\t\t\t\t\t// (e.g. `ref:--author=x` injecting a flag), so drop it instead of passing it through\n\t\t\t\t\t\tif (value.startsWith('-')) continue;\n\n\t\t\t\t\t\tfilters.refs = true;\n\t\t\t\t\t\t// Replace --all with the specific ref or ref range\n\t\t\t\t\t\tsearchArgs.delete('--all');\n\t\t\t\t\t\tsearchArgs.add(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Add regex/string matching flags if we have (--grep, --author, --committer) patterns\n\t\tif (\n\t\t\tsome(\n\t\t\t\tsearchArgs.values(),\n\t\t\t\targ => arg.startsWith('--grep=') || arg.startsWith('--author=') || arg.startsWith('--committer='),\n\t\t\t)\n\t\t) {\n\t\t\tsearchArgs.add(search.matchRegex ? '--extended-regexp' : '--fixed-strings');\n\t\t\tif (search.matchRegex && !search.matchCase) {\n\t\t\t\tsearchArgs.add('--regexp-ignore-case');\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\targs: [...searchArgs.values()],\n\t\tfiles: files,\n\t\tshas: shas,\n\t\tfilters: filters,\n\t\toperations: operations,\n\t};\n}\n\nexport function parseSearchQueryGitHubCommand(\n\tsearch: SearchQuery,\n\tcurrentUser: GitUser | undefined,\n): SearchQueryGitHubCommand {\n\tconst { operations } = parseSearchQuery(search);\n\n\tconst queryArgs = [];\n\tconst filters: SearchQueryFilters = { files: false, type: undefined, refs: false };\n\n\tfor (const [op, values] of operations.entries()) {\n\t\tswitch (op) {\n\t\t\tcase 'message:':\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t}\n\n\t\t\t\t\tqueryArgs.push(value.replace(/ /g, '+'));\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase '-message:':\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// GitHub's search treats a leading '-' on a bare term as an exclusion, so unlike git's\n\t\t\t\t\t// --invert-grep (which flips every --grep in the command), positive and negative message\n\t\t\t\t\t// terms can coexist here -- no mixed-query guard needed for this degradation.\n\t\t\t\t\tqueryArgs.push(`-${value.replace(/ /g, '+')}`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'author:': {\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\tif (!currentUser?.username) continue;\n\n\t\t\t\t\t\tvalue = `@${currentUser.username}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalue = value.replace(/ /g, '+');\n\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\tqueryArgs.push(`author:${value.slice(1)}`);\n\t\t\t\t\t} else if (value.includes('@')) {\n\t\t\t\t\t\tqueryArgs.push(`author-email:${value}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqueryArgs.push(`author-name:${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'committer:': {\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\tif (!currentUser?.username) continue;\n\n\t\t\t\t\t\tvalue = `@${currentUser.username}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalue = value.replace(/ /g, '+');\n\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\tqueryArgs.push(`committer:${value.slice(1)}`);\n\t\t\t\t\t} else if (value.includes('@')) {\n\t\t\t\t\t\tqueryArgs.push(`committer-email:${value}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqueryArgs.push(`committer-name:${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'type:':\n\t\t\tcase 'file:':\n\t\t\tcase 'change:':\n\t\t\tcase 'ref:':\n\t\t\t\t// Not supported in GitHub search (type:'s values, including 'merge', have no GitHub commit-search equivalent)\n\t\t\t\tbreak;\n\n\t\t\tcase 'after:':\n\t\t\tcase 'before:': {\n\t\t\t\tconst flag = op === 'after:' ? 'author-date:>' : 'author-date:<';\n\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if value is YYYY-MM-DD then include it, otherwise we can't use it\n\t\t\t\t\tif (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n\t\t\t\t\t\tqueryArgs.push(`${flag}${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { args: queryArgs, filters: filters, operations: operations };\n}\n\nexport function areSearchContextsEqual(\n\ta: GitCommitSearchContext | undefined,\n\tb: GitCommitSearchContext | undefined,\n\tdeep: boolean,\n): boolean {\n\tif (a === b) return true;\n\tif (a == null || b == null) return false;\n\n\treturn (\n\t\ta.query === b.query &&\n\t\t(!deep ||\n\t\t\t(a.queryFilters.files === b.queryFilters.files &&\n\t\t\t\ta.queryFilters.refs === b.queryFilters.refs &&\n\t\t\t\ta.queryFilters.type === b.queryFilters.type &&\n\t\t\t\ta.matchedFiles.length === b.matchedFiles.length &&\n\t\t\t\ta.matchedFiles.every((f, i) => f.path === b.matchedFiles[i].path)))\n\t);\n}\n\nexport function areSearchQueriesEqual(a: SearchQuery | undefined, b: SearchQuery | undefined): boolean {\n\tif (a === b) return true;\n\tif (a == null || b == null) return false;\n\n\treturn (\n\t\ta.query === b.query &&\n\t\ta.filter === b.filter &&\n\t\ta.matchAll === b.matchAll &&\n\t\ta.matchCase === b.matchCase &&\n\t\ta.matchRegex === b.matchRegex &&\n\t\ta.matchWholeWord === b.matchWholeWord &&\n\t\tBoolean(a.naturalLanguage) === Boolean(b.naturalLanguage)\n\t);\n}\n"],"mappings":";;;;AAiBA,SAAgB,4BAA4B,QAA6B;CACxE,OAAO,GAAG,OAAO,MAAM,GAAG,OAAO,WAAW,MAAM,KAAK,OAAO,YAAY,MAAM,KAC/E,OAAO,aAAa,MAAM,KACxB,OAAO,iBAAiB,MAAM,KAAK,OAAO,kBAAkB,OAAO;AACvE;AAIA,SAAgB,2BAA2B,aAAoD;CAC9F,OAAO,KAAK,OAAO,gBAAgB,WAAW,gBAAgB,WAAW,IAAI,YAAY;AAC1F;AAIA,SAAgB,4BAA4B,eAA0D;CACrG,OAAO,cAAc,KAAI,MAAK,KAAK,OAAO,MAAM,WA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mB,EAAE,kBACvB,QAAQ,EAAE,eAAe,MAAM,QAAQ,EAAE,eAAe;AAE1D"}
|
|
1
|
+
{"version":3,"file":"search.utils.js","names":[],"sources":["../../../../git/src/utils/search.utils.ts"],"sourcesContent":["import { some } from '@gitlens/utils/iterable.js';\nimport type { GitRevisionReference } from '../models/reference.js';\nimport type {\n\tGitCommitSearchContext,\n\tHighlightableOperator,\n\tParsedSearchQuery,\n\tSearchOperators,\n\tSearchOperatorsLongForm,\n\tSearchQuery,\n\tSearchQueryFilters,\n\tSearchQueryGitCommand,\n\tSearchQueryGitHubCommand,\n} from '../models/search.js';\nimport { searchOperators, searchOperatorsToLongFormMap } from '../models/search.js';\nimport type { GitUser } from '../models/user.js';\nimport { isSha, shortenRevision } from './revision.utils.js';\n\nexport function getSearchQueryComparisonKey(search: SearchQuery): string {\n\treturn `${search.query}|${search.matchAll ? 'A' : ''}${search.matchCase ? 'C' : ''}${\n\t\tsearch.matchRegex ? 'R' : ''\n\t}${search.matchWholeWord ? 'W' : ''}${search.naturalLanguage ? 'NL' : ''}`;\n}\n\nexport function createSearchQueryForCommit(ref: string): string;\nexport function createSearchQueryForCommit(commit: GitRevisionReference): string;\nexport function createSearchQueryForCommit(refOrCommit: string | GitRevisionReference): string {\n\treturn `#:${typeof refOrCommit === 'string' ? shortenRevision(refOrCommit) : refOrCommit.name}`;\n}\n\nexport function createSearchQueryForCommits(refs: string[]): string;\nexport function createSearchQueryForCommits(commits: GitRevisionReference[]): string;\nexport function createSearchQueryForCommits(refsOrCommits: (string | GitRevisionReference)[]): string {\n\treturn refsOrCommits.map(r => `#:${typeof r === 'string' ? shortenRevision(r) : r.name}`).join(' ');\n}\n\nexport function rebuildSearchQueryFromParsed(parsed: ParsedSearchQuery): string {\n\tconst parts: string[] = [];\n\n\tfor (const [operator, values] of parsed.operations) {\n\t\tfor (const value of values) {\n\t\t\tparts.push(`${operator}${value}`);\n\t\t}\n\t}\n\n\treturn parts.join(' ');\n}\n\nexport function parseSearchQuery(search: SearchQuery, validate: boolean = false): ParsedSearchQuery {\n\tconst operations = new Map<SearchOperatorsLongForm, Set<string>>();\n\tconst query = search.query.trim();\n\n\tlet errors: string[] | undefined;\n\tlet operatorRanges: Array<{ start: number; end: number; operator: HighlightableOperator }> | undefined;\n\tlet pos = 0;\n\n\twhile (pos < query.length) {\n\t\t// Skip whitespace\n\t\tif (/\\s/.test(query[pos])) {\n\t\t\tpos++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Try to match an operator\n\t\tlet matchedOperator = false;\n\t\tlet op: SearchOperators | undefined;\n\t\tlet value: string | undefined;\n\n\t\t// Check for operators (starting with longer ones first to avoid partial matches)\n\t\tfor (const operator of searchOperators) {\n\t\t\tif (!operator.length) continue;\n\n\t\t\tif (query.startsWith(operator, pos)) {\n\t\t\t\top = operator as SearchOperators;\n\t\t\t\tconst operatorStart = pos;\n\t\t\t\tconst startPos = pos + operator.length;\n\t\t\t\tpos = startPos;\n\n\t\t\t\t// Track operator position\n\t\t\t\toperatorRanges ??= [];\n\t\t\t\toperatorRanges.push({\n\t\t\t\t\tstart: operatorStart,\n\t\t\t\t\tend: startPos,\n\t\t\t\t\toperator: op,\n\t\t\t\t});\n\n\t\t\t\t// Skip optional space after operator\n\t\t\t\tif (query[pos] === ' ') {\n\t\t\t\t\tpos++;\n\t\t\t\t}\n\n\t\t\t\t// Extract the value and check if it is quoted\n\t\t\t\tif (query[pos] === '\"') {\n\t\t\t\t\tconst endQuotePos = query.indexOf('\"', pos + 1);\n\t\t\t\t\tif (endQuotePos !== -1) {\n\t\t\t\t\t\tvalue = query.substring(pos, endQuotePos + 1);\n\t\t\t\t\t\tpos = endQuotePos + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Unterminated quote, take the rest of the string\n\t\t\t\t\t\tvalue = query.substring(pos);\n\t\t\t\t\t\tpos = query.length;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Unquoted value - take until whitespace\n\t\t\t\t\tconst nextSpacePos = query.indexOf(' ', pos);\n\t\t\t\t\tconst valueEndPos = nextSpacePos !== -1 ? nextSpacePos : query.length;\n\t\t\t\t\tvalue = query.substring(pos, valueEndPos);\n\t\t\t\t\tpos = valueEndPos;\n\t\t\t\t}\n\n\t\t\t\tmatchedOperator = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!matchedOperator) {\n\t\t\t// No operator found, parse as text\n\t\t\tconst textStart = pos;\n\t\t\tlet text: string;\n\n\t\t\t// Check if text is quoted\n\t\t\tif (query[pos] === '\"') {\n\t\t\t\tconst endQuotePos = query.indexOf('\"', pos + 1);\n\t\t\t\tif (endQuotePos !== -1) {\n\t\t\t\t\ttext = query.substring(pos, endQuotePos + 1);\n\t\t\t\t\tpos = endQuotePos + 1;\n\t\t\t\t} else {\n\t\t\t\t\t// Unterminated quote, take the rest of the string\n\t\t\t\t\ttext = query.substring(pos);\n\t\t\t\t\tpos = query.length;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Unquoted text - take until whitespace\n\t\t\t\tconst nextSpacePos = query.indexOf(' ', pos);\n\t\t\t\tconst valueEndPos = nextSpacePos !== -1 ? nextSpacePos : query.length;\n\t\t\t\ttext = query.substring(pos, valueEndPos);\n\t\t\t\tpos = valueEndPos;\n\t\t\t}\n\n\t\t\t// Handle special text tokens (@me, SHA)\n\t\t\tif (text === '@me') {\n\t\t\t\top = 'author:';\n\t\t\t\t// Track @me position for highlighting\n\t\t\t\toperatorRanges ??= [];\n\t\t\t\toperatorRanges.push({\n\t\t\t\t\tstart: textStart,\n\t\t\t\t\tend: textStart + text.length,\n\t\t\t\t\toperator: '@me',\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\top = isSha(text) ? 'commit:' : 'message:';\n\t\t\t}\n\t\t\tvalue = text;\n\t\t}\n\n\t\t// Validate operator has a value\n\t\tif (op && !value) {\n\t\t\tif (!validate) continue;\n\n\t\t\terrors ??= [];\n\t\t\terrors.push(`'${op}' requires a value`);\n\t\t}\n\n\t\t// Add the discovered operation to our map\n\t\tif (op && value) {\n\t\t\tconst longFormOp = searchOperatorsToLongFormMap.get(op);\n\t\t\tif (longFormOp) {\n\t\t\t\tlet values = operations.get(longFormOp);\n\t\t\t\tif (values == null) {\n\t\t\t\t\tvalues = new Set();\n\t\t\t\t\toperations.set(longFormOp, values);\n\t\t\t\t}\n\t\t\t\tvalues.add(value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (validate && operations.get('message:')?.size && operations.get('-message:')?.size) {\n\t\terrors ??= [];\n\t\terrors.push(\"Cannot combine 'message:' and '-message:' in the same query\");\n\t}\n\n\treturn {\n\t\toperations: operations,\n\t\t...(errors?.length && { errors: errors }),\n\t\t...(operatorRanges?.length && { operatorRanges: operatorRanges }),\n\t};\n}\n\nexport function parseSearchQueryGitCommand(\n\tsearch: SearchQuery,\n\tcurrentUser: GitUser | undefined,\n\toptions?: { hiddenRefExcludes?: readonly string[] },\n): SearchQueryGitCommand {\n\tconst { operations } = parseSearchQuery(search);\n\n\tconst searchArgs = new Set<string>();\n\tconst files: string[] = [];\n\tlet shas;\n\tconst filters: SearchQueryFilters = { files: false, type: undefined, refs: false };\n\n\tlet op;\n\tlet values = operations.get('commit:');\n\tif (values != null) {\n\t\tfor (let value of values) {\n\t\t\tif (!value) continue;\n\n\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\tif (!value) continue;\n\t\t\t}\n\n\t\t\tsearchArgs.add(value);\n\t\t}\n\t\tshas = searchArgs;\n\t} else {\n\t\tfor (const exclude of options?.hiddenRefExcludes ?? []) {\n\t\t\tsearchArgs.add(exclude);\n\t\t}\n\t\tsearchArgs.add('--all');\n\n\t\tfor ([op, values] of operations.entries()) {\n\t\t\tswitch (op) {\n\t\t\t\tcase 'message:':\n\t\t\t\t\tif (search.matchAll) {\n\t\t\t\t\t\tsearchArgs.add('--all-match');\n\t\t\t\t\t}\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--grep=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '-message:': {\n\t\t\t\t\t// --invert-grep flips ALL --grep patterns in the command, so a query mixing positive\n\t\t\t\t\t// message: terms with negative -message: terms can't be represented in one git invocation.\n\t\t\t\t\t// parseSearchQuery's validate path rejects that combination up front; this is a defensive\n\t\t\t\t\t// fallback for callers that skip validation -- drop the excluded terms rather than\n\t\t\t\t\t// silently inverting the positive matches.\n\t\t\t\t\tif (operations.get('message:')?.size) break;\n\n\t\t\t\t\tlet hasValue = false;\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--grep=${value}`);\n\t\t\t\t\t\thasValue = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (hasValue) {\n\t\t\t\t\t\tsearchArgs.add('--invert-grep');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'author:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\t\tif (!currentUser?.name) continue;\n\n\t\t\t\t\t\t\tvalue = currentUser.name;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\t\tvalue = value.slice(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--author=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'committer:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\t\tif (!currentUser?.name) continue;\n\n\t\t\t\t\t\t\tvalue = currentUser.name;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\t\tvalue = value.slice(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`--committer=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'type:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value === 'stash') {\n\t\t\t\t\t\t\tfilters.type = 'stash';\n\t\t\t\t\t\t\tsearchArgs.add('--no-walk');\n\t\t\t\t\t\t} else if (value === 'tip') {\n\t\t\t\t\t\t\tfilters.type = 'tip';\n\t\t\t\t\t\t} else if (value === 'wip') {\n\t\t\t\t\t\t\tfilters.type = 'wip';\n\t\t\t\t\t\t} else if (value === 'merge') {\n\t\t\t\t\t\t\tfilters.type = 'merge';\n\t\t\t\t\t\t\tsearchArgs.add('--merges');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'file:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\t\tfilters.files = true;\n\t\t\t\t\t\t\tfiles.push(value);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfilters.files = true;\n\n\t\t\t\t\t\t\tconst prefix = search.matchCase ? '' : ':(icase)';\n\t\t\t\t\t\t\tif (value.includes('**')) {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}:(glob)${value}`);\n\t\t\t\t\t\t\t} else if (/[./\\\\*?|![\\]{}]/.test(value)) {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}${value}`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfiles.push(`${prefix}*${value}*`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'change:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfilters.files = true;\n\t\t\t\t\t\tsearchArgs.add(search.matchRegex ? `-G${value}` : `-S${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'after:':\n\t\t\t\tcase 'before:': {\n\t\t\t\t\tconst flag = op === 'after:' ? '--since' : '--until';\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsearchArgs.add(`${flag}=${value}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'ref:':\n\t\t\t\t\tfor (let value of values) {\n\t\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// A value starting with `-` would be consumed by git as an option rather than a ref\n\t\t\t\t\t\t// (e.g. `ref:--author=x` injecting a flag), so drop it instead of passing it through\n\t\t\t\t\t\tif (value.startsWith('-')) continue;\n\n\t\t\t\t\t\tfilters.refs = true;\n\t\t\t\t\t\t// Replace --all with the specific ref or ref range\n\t\t\t\t\t\tsearchArgs.delete('--all');\n\t\t\t\t\t\tfor (const exclude of options?.hiddenRefExcludes ?? []) {\n\t\t\t\t\t\t\tsearchArgs.delete(exclude);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsearchArgs.add(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Add regex/string matching flags if we have (--grep, --author, --committer) patterns\n\t\tif (\n\t\t\tsome(\n\t\t\t\tsearchArgs.values(),\n\t\t\t\targ => arg.startsWith('--grep=') || arg.startsWith('--author=') || arg.startsWith('--committer='),\n\t\t\t)\n\t\t) {\n\t\t\tsearchArgs.add(search.matchRegex ? '--extended-regexp' : '--fixed-strings');\n\t\t\tif (search.matchRegex && !search.matchCase) {\n\t\t\t\tsearchArgs.add('--regexp-ignore-case');\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\targs: [...searchArgs.values()],\n\t\tfiles: files,\n\t\tshas: shas,\n\t\tfilters: filters,\n\t\toperations: operations,\n\t};\n}\n\nexport function parseSearchQueryGitHubCommand(\n\tsearch: SearchQuery,\n\tcurrentUser: GitUser | undefined,\n): SearchQueryGitHubCommand {\n\tconst { operations } = parseSearchQuery(search);\n\n\tconst queryArgs = [];\n\tconst filters: SearchQueryFilters = { files: false, type: undefined, refs: false };\n\n\tfor (const [op, values] of operations.entries()) {\n\t\tswitch (op) {\n\t\t\tcase 'message:':\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t}\n\n\t\t\t\t\tqueryArgs.push(value.replace(/ /g, '+'));\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase '-message:':\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (search.matchWholeWord && search.matchRegex) {\n\t\t\t\t\t\tvalue = `\\\\b${value}\\\\b`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// GitHub's search treats a leading '-' on a bare term as an exclusion, so unlike git's\n\t\t\t\t\t// --invert-grep (which flips every --grep in the command), positive and negative message\n\t\t\t\t\t// terms can coexist here -- no mixed-query guard needed for this degradation.\n\t\t\t\t\tqueryArgs.push(`-${value.replace(/ /g, '+')}`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'author:': {\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\tif (!currentUser?.username) continue;\n\n\t\t\t\t\t\tvalue = `@${currentUser.username}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalue = value.replace(/ /g, '+');\n\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\tqueryArgs.push(`author:${value.slice(1)}`);\n\t\t\t\t\t} else if (value.includes('@')) {\n\t\t\t\t\t\tqueryArgs.push(`author-email:${value}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqueryArgs.push(`author-name:${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'committer:': {\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value === '@me') {\n\t\t\t\t\t\tif (!currentUser?.username) continue;\n\n\t\t\t\t\t\tvalue = `@${currentUser.username}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalue = value.replace(/ /g, '+');\n\t\t\t\t\tif (value.startsWith('@')) {\n\t\t\t\t\t\tqueryArgs.push(`committer:${value.slice(1)}`);\n\t\t\t\t\t} else if (value.includes('@')) {\n\t\t\t\t\t\tqueryArgs.push(`committer-email:${value}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqueryArgs.push(`committer-name:${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'type:':\n\t\t\tcase 'file:':\n\t\t\tcase 'change:':\n\t\t\tcase 'ref:':\n\t\t\t\t// Not supported in GitHub search (type:'s values, including 'merge', have no GitHub commit-search equivalent)\n\t\t\t\tbreak;\n\n\t\t\tcase 'after:':\n\t\t\tcase 'before:': {\n\t\t\t\tconst flag = op === 'after:' ? 'author-date:>' : 'author-date:<';\n\n\t\t\t\tfor (let value of values) {\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\tif (value.startsWith('\"') && value.endsWith('\"')) {\n\t\t\t\t\t\tvalue = value.slice(1, -1);\n\t\t\t\t\t\tif (!value) continue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if value is YYYY-MM-DD then include it, otherwise we can't use it\n\t\t\t\t\tif (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n\t\t\t\t\t\tqueryArgs.push(`${flag}${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { args: queryArgs, filters: filters, operations: operations };\n}\n\nexport function areSearchContextsEqual(\n\ta: GitCommitSearchContext | undefined,\n\tb: GitCommitSearchContext | undefined,\n\tdeep: boolean,\n): boolean {\n\tif (a === b) return true;\n\tif (a == null || b == null) return false;\n\n\treturn (\n\t\ta.query === b.query &&\n\t\t(!deep ||\n\t\t\t(a.queryFilters.files === b.queryFilters.files &&\n\t\t\t\ta.queryFilters.refs === b.queryFilters.refs &&\n\t\t\t\ta.queryFilters.type === b.queryFilters.type &&\n\t\t\t\ta.matchedFiles.length === b.matchedFiles.length &&\n\t\t\t\ta.matchedFiles.every((f, i) => f.path === b.matchedFiles[i].path)))\n\t);\n}\n\nexport function areSearchQueriesEqual(a: SearchQuery | undefined, b: SearchQuery | undefined): boolean {\n\tif (a === b) return true;\n\tif (a == null || b == null) return false;\n\n\treturn (\n\t\ta.query === b.query &&\n\t\ta.filter === b.filter &&\n\t\ta.matchAll === b.matchAll &&\n\t\ta.matchCase === b.matchCase &&\n\t\ta.matchRegex === b.matchRegex &&\n\t\ta.matchWholeWord === b.matchWholeWord &&\n\t\tBoolean(a.naturalLanguage) === Boolean(b.naturalLanguage)\n\t);\n}\n"],"mappings":";;;;AAiBA,SAAgB,4BAA4B,QAA6B;CACxE,OAAO,GAAG,OAAO,MAAM,GAAG,OAAO,WAAW,MAAM,KAAK,OAAO,YAAY,MAAM,KAC/E,OAAO,aAAa,MAAM,KACxB,OAAO,iBAAiB,MAAM,KAAK,OAAO,kBAAkB,OAAO;AACvE;AAIA,SAAgB,2BAA2B,aAAoD;CAC9F,OAAO,KAAK,OAAO,gBAAgB,WAAW,gBAAgB,WAAW,IAAI,YAAY;AAC1F;AAIA,SAAgB,4BAA4B,eAA0D;CACrG,OAAO,cAAc,KAAI,MAAK,KAAK,OAAO,MAAM,WAAW,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,GAAG;AACnG;AAEA,SAAgB,6BAA6B,QAAmC;CAC/E,MAAM,QAAkB,CAAC;CAEzB,KAAK,MAAM,CAAC,UAAU,WAAW,OAAO,YACvC,KAAK,MAAM,SAAS,QACnB,MAAM,KAAK,GAAG,WAAW,OAAO;CAIlC,OAAO,MAAM,KAAK,GAAG;AACtB;AAEA,SAAgB,iBAAiB,QAAqB,WAAoB,OAA0B;CACnG,MAAM,6BAAa,IAAI,IAA0C;CACjE,MAAM,QAAQ,OAAO,MAAM,KAAK;CAEhC,IAAI;CACJ,IAAI;CACJ,IAAI,MAAM;CAEV,OAAO,MAAM,MA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,SAAS,QAAQ;IACzB,IAAI,CAAC,OAAO;IAEZ,IAAI,MAAM,WAAW,IAAG,KAAK,MAAM,SAAS,IAAG,GAAG;KACjD,QAAQ,MAAM,MAAM,GAAG,EAAE;KACzB,IAAI,CAAC,OAAO;IACb;IAGA,IAAI,CAAC,sBAAsB,KAAK,KAAK,GACpC,UAAU,KAAK,GAAG,OAAO,OAAO;GAElC;GACA;EACD;CACD;CAGD,OAAO;EAAE,MAAM;EAAoB;EAAqB;CAAW;AACpE;AAEA,SAAgB,uBACf,GACA,GACA,MACU;CACV,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,KAAK,QAAQ,KAAK,MAAM,OAAO;CAEnC,OACC,EAAE,UAAU,EAAE,UACb,CAAC,QACA,EAAE,aAAa,UAAU,EAAE,aAAa,SACxC,EAAE,aAAa,SAAS,EAAE,aAAa,QACvC,EAAE,aAAa,SAAS,EAAE,aAAa,QACvC,EAAE,aAAa,WAAW,EAAE,aAAa,UACzC,EAAE,aAAa,OAAO,GAAG,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,IAAI;AAEpE;AAEA,SAAgB,sBAAsB,GAA4B,GAAqC;CACtG,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,KAAK,QAAQ,KAAK,MAAM,OAAO;CAEnC,OACC,EAAE,UAAU,EAAE,SACd,EAAE,WAAW,EAAE,UACf,EAAE,aAAa,EAAE,YACjB,EAAE,cAAc,EAAE,aAClB,EAAE,eAAe,EAAE,cACnB,EAAE,mBAAmB,EAAE,kBACvB,QAAQ,EAAE,eAAe,MAAM,QAAQ,EAAE,eAAe;AAE1D"}
|
package/dist/git-cli/exec/git.js
CHANGED
|
@@ -15,6 +15,7 @@ import { EventLoopMonitor } from "./eventLoopMonitor.js";
|
|
|
15
15
|
import { GitQueue, getPrimaryGitCommand, inferGitCommandPriority } from "./gitQueue.js";
|
|
16
16
|
import { getMovedHead } from "./headState.js";
|
|
17
17
|
import { KeyedSequencer, isConfigCommand, isIndexWriteCommand, retryWhileConfigLocked, retryWhileIndexLocked, toExitCode } from "./indexLock.js";
|
|
18
|
+
import { InvalidGitConfigError, UnableToFindGitError } from "./locator.js";
|
|
18
19
|
import { resolve } from "path";
|
|
19
20
|
import { stat } from "fs/promises";
|
|
20
21
|
import * as process from "process";
|
|
@@ -204,7 +205,7 @@ function isGitAnswer(ex) {
|
|
|
204
205
|
}
|
|
205
206
|
/** Whether a `rev-parse` failed without an answer from git (see {@link isGitAnswer}), so says nothing about its path */
|
|
206
207
|
function isGitUnanswered(ex) {
|
|
207
|
-
return isCancellationError(ex) || ex instanceof GitError && !isGitAnswer(ex);
|
|
208
|
+
return isCancellationError(ex) || ex instanceof UnableToFindGitError || ex instanceof InvalidGitConfigError || ex instanceof GitError && !isGitAnswer(ex);
|
|
208
209
|
}
|
|
209
210
|
/** Rejects an `errors: 'ignore'` `rev-parse` that gave no answer (see {@link isGitAnswer}), whose empty output would read as one */
|
|
210
211
|
function throwIfUnanswered(result) {
|