@gitkraken/core-gitlens 0.15.1 → 0.15.2

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/git/utils/revision.utils.d.ts +3 -0
  3. package/dist/git/utils/revision.utils.js +5 -1
  4. package/dist/git/utils/revision.utils.js.map +1 -1
  5. package/dist/plus/git-github/api/github.d.ts +4 -0
  6. package/dist/plus/git-github/api/github.js +31 -4
  7. package/dist/plus/git-github/api/github.js.map +1 -1
  8. package/dist/plus/git-github/api/types.d.ts +4 -0
  9. package/dist/plus/git-github/providers/github/revision.js +12 -1
  10. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  11. package/dist/plus/integrations/collectionMetadata.d.ts +22 -7
  12. package/dist/plus/integrations/collectionMetadata.js +49 -6
  13. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  14. package/dist/plus/integrations/providers/providersApi.js +5 -4
  15. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  16. package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +4 -21
  17. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +13 -48
  18. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -1
  19. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +20 -6
  20. package/dist/plus/integrations/providers/utils/providerPaging.js +50 -13
  21. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  22. package/dist/plus/integrations/reads/issues.js +1 -1
  23. package/dist/plus/integrations/reads/issues.js.map +1 -1
  24. package/dist/plus/integrations/reads/paging.js +1 -1
  25. package/dist/plus/integrations/reads/paging.js.map +1 -1
  26. package/dist/plus/integrations/results.d.ts +12 -7
  27. package/dist/plus/integrations/results.js +3 -4
  28. package/dist/plus/integrations/results.js.map +1 -1
  29. package/docs/integrations.md +9 -5
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.15.2] - 2026-10-20
10
+
11
+ ### Changed
12
+
13
+ - Changes the `'unreadable-items'` warning for a Jira or Jira Data Center issue that `@gitkraken/provider-apis` can't read to take its `unreadableItems` from the structured `skippedItems` of the failure instead of parsing its message, so a page that skipped more than ten issues now names every one of them and reports `complete: true`, where it named ten and reported `complete: false`, and a key-looking token in an error reason no longer adds a key. `complete` is `false` when a skipped issue had no key, when the SDK's report was malformed (no list of keys, or more than keys in it), or when it said issues were skipped and named none. `keys` holds the spelling Jira returned, which is also how a published issue's id spells its key, and doesn't answer a lookup by another case or by a key the issue had before it moved, so compare case-normalized on both sides. The raw `CollectionMetadata` a drained read returns (`getIssuesForProjectWithTruncationResult`, `searchMyIssuesWithTruncationResult`) now merges `skippedItems` across the pages of a drain (keys in order, totals added) and across the reads of a user's relationships, which are merged into one failure per scope however they word it or split the skipped issues over their pages (keys in order; `total` is the larger of their totals, at least the keys named), so a user's relationships publish one warning for a project's skipped issues, with the message of the report that names more keys. The `total` of a drain is the sum of its pages' totals, so a key repeated across pages that shifted counts once per page. Before, the pages of a drain were folded into the first page's failure. A failure that carries `skippedItems` is never classified by its message, so a skipped issue whose own error names a status (`401`) is not an authentication failure, and a failure that doesn't carry it is no longer taken for a skip, whatever its message says. Failures no longer carry the `unreadableItems` property #6011 added to them; the warning still does ([#6035](https://github.com/gitkraken/vscode-gitlens/issues/6035)) (plus/integrations)
14
+
9
15
  ## [0.15.1] - 2026-10-19
10
16
 
11
17
  ### Added
@@ -792,7 +798,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
792
798
 
793
799
  - Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
794
800
 
795
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.15.1...HEAD
801
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.15.2...HEAD
802
+ [0.15.2]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.15.1...gitkraken:releases/core/v0.15.2
796
803
  [0.15.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.15.0...gitkraken:releases/core/v0.15.1
797
804
  [0.15.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.14.0...gitkraken:releases/core/v0.15.0
798
805
  [0.14.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.13.0...gitkraken:releases/core/v0.14.0
@@ -1,4 +1,5 @@
1
1
  import { GitRevisionRange, GitRevisionRangeNotation, uncommitted } from "../models/revision.js";
2
+ import { ResolvedRevision } from "../providers/revision.js";
2
3
  //#region ../git/src/utils/revision.utils.d.ts
3
4
  /** Checks if the rev looks like a revision with a navigation suffixes (like ^, @, ~, or :) */
4
5
  export declare function isRevisionWithSuffix(rev: string): boolean;
@@ -33,5 +34,7 @@ export declare function getRevisionRangeParts(revRange: GitRevisionRange): {
33
34
  } | undefined;
34
35
  export declare function isRevisionRange(rev: string | undefined, rangeType?: 'any' | 'qualified' | 'qualified-double-dot' | 'qualified-triple-dot'): rev is GitRevisionRange;
35
36
  export declare function stripOrigin<T extends string | GitRevisionRange | undefined>(ref: T): T;
37
+ /** Whether the file at `relativePath` doesn't exist at a resolved revision — nothing touched it yet, or its last change there deleted it or moved it away (a copy is reported instead of a rename when `diff.renames=copies`) */
38
+ export declare function isResolvedRevisionMissing(resolved: ResolvedRevision, relativePath: string): boolean;
36
39
  //#endregion
37
40
  //# sourceMappingURL=revision.utils.d.ts.map
@@ -94,7 +94,11 @@ function isRevisionRange(rev, rangeType = "any") {
94
94
  function stripOrigin(ref) {
95
95
  return ref?.replace(/(?:^|(?<=..))origin\//, "");
96
96
  }
97
+ /** Whether the file at `relativePath` doesn't exist at a resolved revision — nothing touched it yet, or its last change there deleted it or moved it away (a copy is reported instead of a rename when `diff.renames=copies`) */
98
+ function isResolvedRevisionMissing(resolved, relativePath) {
99
+ return resolved.sha === "0000000000000000000000000000000000000000-" || resolved.status === "D" || (resolved.status === "R" || resolved.status === "C") && resolved.path != null && resolved.path !== relativePath;
100
+ }
97
101
  //#endregion
98
- export { createRevisionRange, getAbbreviatedShaLength, getRevisionRangeParts, isRevisionRange, isRevisionWithSuffix, isSha, isShaWithOptionalRevisionSuffix, isShaWithParentSuffix, isUncommitted, isUncommittedStaged, isUncommittedStagedWithParentSuffix, isUncommittedWithParentSuffix, resetAbbreviatedShaLength, setAbbreviatedShaLength, shortenRevision, stripOrigin };
102
+ export { createRevisionRange, getAbbreviatedShaLength, getRevisionRangeParts, isResolvedRevisionMissing, isRevisionRange, isRevisionWithSuffix, isSha, isShaWithOptionalRevisionSuffix, isShaWithParentSuffix, isUncommitted, isUncommittedStaged, isUncommittedStagedWithParentSuffix, isUncommittedWithParentSuffix, resetAbbreviatedShaLength, setAbbreviatedShaLength, shortenRevision, stripOrigin };
99
103
 
100
104
  //# sourceMappingURL=revision.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"revision.utils.js","names":[],"sources":["../../../../git/src/utils/revision.utils.ts"],"sourcesContent":["import type { GitRevisionRange, GitRevisionRangeNotation } from '../models/revision.js';\nimport { deletedOrMissing, uncommitted, uncommittedStaged } from '../models/revision.js';\n\nconst rangeRegex = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)?(\\.\\.\\.?)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)?$/;\nconst qualifiedRangeRegex = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.\\.?)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst qualifiedDoubleDotRange = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst qualifiedTripleDotRange = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.\\.)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst shaWithOptionalRevisionSuffixRegex = /(^[0-9a-f]{40}([\\^@~:]\\S*)?$)|(^[0]{40}(:|-)$)/;\nconst revisionWithSuffixRegex = /^\\S+[\\^@~:]\\S*$/;\nconst shaRegex = /(^[0-9a-f]{40}$)|(^[0]{40}(:|-)$)/;\nconst shaShortRegex = /(^[0-9a-f]{7,40}$)|(^[0]{40}(:|-)$)/;\nconst shaParentRegex = /(^[0-9a-f]{40})\\^[0-3]?$/;\nconst shaShortenRegex = /^(.*?)([\\^@~:].*)?$/;\nconst uncommittedRegex = /^[0]{40}(?:[\\^@~:]\\S*)?:?$/;\nconst uncommittedStagedRegex = /^[0]{40}([\\^@~]\\S*)?:$/;\n\nfunction isMatch(regex: RegExp, rev: string | undefined) {\n\treturn !rev ? false : regex.test(rev);\n}\n\n/** Checks if the rev looks like a revision with a navigation suffixes (like ^, @, ~, or :) */\nexport function isRevisionWithSuffix(rev: string): boolean {\n\treturn isMatch(revisionWithSuffixRegex, rev) && rev.length > 40;\n}\n\n/** Checks if the rev looks like a SHA-1 hash\n * @param allowShort If true, allows short SHAs (7-40 characters)\n */\nexport function isSha(rev: string, allowShort: boolean = false): boolean {\n\treturn isMatch(allowShort ? shaShortRegex : shaRegex, rev);\n}\n\n/** Checks if the rev looks like a SHA-1 hash with an optional revision navigation suffixes (like ^, @, ~, or :) */\nexport function isShaWithOptionalRevisionSuffix(rev: string): boolean {\n\treturn isMatch(shaWithOptionalRevisionSuffixRegex, rev);\n}\n\n/** Checks if the rev looks like a SHA-1 hash with a ^ parent suffix */\nexport function isShaWithParentSuffix(rev: string): boolean {\n\treturn isMatch(shaParentRegex, rev);\n}\n\nexport function isUncommitted(rev: string | undefined, exact: boolean = false): boolean {\n\treturn rev === uncommitted || rev === uncommittedStaged || (!exact && isMatch(uncommittedRegex, rev));\n}\n\nexport function isUncommittedStaged(rev: string | undefined, exact: boolean = false): boolean {\n\treturn rev === uncommittedStaged || (!exact && isMatch(uncommittedStagedRegex, rev));\n}\n\nexport function isUncommittedWithParentSuffix(rev: string | undefined): rev is `${typeof uncommitted}${'^' | ':^'}` {\n\treturn rev === `${uncommitted}^` || rev === `${uncommittedStaged}^`;\n}\n\nexport function isUncommittedStagedWithParentSuffix(\n\trev: string | undefined,\n): rev is `${typeof uncommitted}${'^' | ':^'}` {\n\treturn rev === `${uncommittedStaged}^`;\n}\n\nlet abbreviatedShaLength = 7;\nexport function getAbbreviatedShaLength(): number {\n\treturn abbreviatedShaLength;\n}\n\nexport function setAbbreviatedShaLength(length: number): void {\n\tabbreviatedShaLength = length;\n}\n\n/** Resets the abbreviated SHA length to the default (7). For test isolation. */\nexport function resetAbbreviatedShaLength(): void {\n\tabbreviatedShaLength = 7;\n}\n\nexport function shortenRevision(\n\trev: string | undefined,\n\toptions?: {\n\t\tstrings?: { uncommitted?: string; uncommittedStaged?: string; working?: string };\n\t},\n): string {\n\tif (rev === deletedOrMissing) return '(deleted)';\n\tif (!rev) return options?.strings?.working ?? '';\n\tif (isUncommitted(rev)) {\n\t\treturn isUncommittedStaged(rev)\n\t\t\t? (options?.strings?.uncommittedStaged ?? 'Index')\n\t\t\t: (options?.strings?.uncommitted ?? 'Working Tree');\n\t}\n\tif (isRevisionRange(rev) || !isShaWithOptionalRevisionSuffix(rev)) return rev;\n\n\t// Don't allow shas to be shortened to less than 5 characters\n\tconst len = Math.max(5, getAbbreviatedShaLength());\n\n\t// If we have a suffix, append it\n\tconst match = shaShortenRegex.exec(rev);\n\tif (match != null) {\n\t\tconst [, rev, suffix] = match;\n\n\t\tif (suffix != null) {\n\t\t\treturn `${rev.substring(0, len)}${suffix}`;\n\t\t}\n\t}\n\n\treturn rev.substring(0, len);\n}\n\nexport function createRevisionRange(\n\tleft: string | undefined,\n\tright: string | undefined,\n\tnotation: GitRevisionRangeNotation,\n): GitRevisionRange {\n\treturn `${left ?? ''}${notation}${right ?? ''}`;\n}\n\nexport function getRevisionRangeParts(\n\trevRange: GitRevisionRange,\n): { left: string | undefined; right: string | undefined; notation: GitRevisionRangeNotation } | undefined {\n\tconst match = rangeRegex.exec(revRange);\n\tif (match == null) return undefined;\n\n\tconst [, left, notation, right] = match;\n\treturn {\n\t\tleft: left || undefined,\n\t\tright: right || undefined,\n\t\tnotation: notation as GitRevisionRangeNotation,\n\t};\n}\n\nexport function isRevisionRange(\n\trev: string | undefined,\n\trangeType: 'any' | 'qualified' | 'qualified-double-dot' | 'qualified-triple-dot' = 'any',\n): rev is GitRevisionRange {\n\tif (rev == null) return false;\n\n\tswitch (rangeType) {\n\t\tcase 'qualified':\n\t\t\treturn qualifiedRangeRegex.test(rev);\n\t\tcase 'qualified-double-dot':\n\t\t\treturn qualifiedDoubleDotRange.test(rev);\n\t\tcase 'qualified-triple-dot':\n\t\t\treturn qualifiedTripleDotRange.test(rev);\n\t\tdefault:\n\t\t\treturn rangeRegex.test(rev);\n\t}\n}\n\n//** Strips `origin/` from a reference or range, because we \"fake\" origin as the default remote */\nexport function stripOrigin<T extends string | GitRevisionRange | undefined>(ref: T): T {\n\treturn ref?.replace(/(?:^|(?<=..))origin\\//, '') as T;\n}\n"],"mappings":";;AAGA,MAAM,aAAa;AACnB,MAAM,sBAAsB;AAC5B,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,qCAAqC;AAC3C,MAAM,0BAA0B;AAChC,MAAM,WAAW;AACjB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAAe,KAAyB;CACxD,OAAO,CAAC,MAAM,QAAQ,MAAM,KAAK,GAAG;AACrC;;AAGA,SAAgB,qBAAqB,KAAsB;CAC1D,OAAO,QAAQ,yBAAyB,GAAG,KAAK,IAAI,SAAS;AAC9D;;;;AAKA,SAAgB,MAAM,KAAa,aAAsB,OAAgB;CACxE,OAAO,QAAQ,aAAa,gBAAgB,UA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AgB,oBACf,MACA,OACA,UACmB;CACnB,OAAO,GAAG,QAAQ,KAAK,WAAW,SAAS;AAC5C;AAEA,SAAgB,sBACf,UAC0G;CAC1G,MAAM,QAAQ,WAAW,KAAK,QAAQ;CACtC,IAAI,SAAS,MAAM,OAAO,KAAA;CAE1B,MAAM,GAAG,MAAM,UAAU,SAAS;CAClC,OAAO;EACN,MAAM,QAAQ,KAAA;EACd,OAAO,SAAS,KAAA;EACN;CACX;AACD;AAEA,SAAgB,gBACf,KACA,YAAmF,OACzD;CAC1B,IAAI,OAAO,MAAM,OAAO;CAExB,QAAQ,WAAR;EACC,KAAK,aACJ,OAAO,oBAAoB,KAAK,GAAG;EACpC,KAAK,wBACJ,OAAO,wBAAwB,KAAK,GAAG;EACxC,KAAK,wBACJ,OAAO,wBAAwB,KAAK,GAAG;EACxC,SACC,OAAO,WAAW,KAAK,GAAG;CAC5B;AACD;AAGA,SAAgB,YAA6D,KAAW;CACvF,OAAO,KAAK,QAAQ,yBAAyB,EAAE;AAChD"}
1
+ {"version":3,"file":"revision.utils.js","names":[],"sources":["../../../../git/src/utils/revision.utils.ts"],"sourcesContent":["import type { GitRevisionRange, GitRevisionRangeNotation } from '../models/revision.js';\nimport { deletedOrMissing, uncommitted, uncommittedStaged } from '../models/revision.js';\nimport type { ResolvedRevision } from '../providers/revision.js';\n\nconst rangeRegex = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)?(\\.\\.\\.?)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)?$/;\nconst qualifiedRangeRegex = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.\\.?)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst qualifiedDoubleDotRange = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst qualifiedTripleDotRange = /^([\\w\\-/]+(?:\\.[\\w\\-/]+)*)(\\.\\.\\.)([\\w\\-/]+(?:\\.[\\w\\-/]+)*)$/;\nconst shaWithOptionalRevisionSuffixRegex = /(^[0-9a-f]{40}([\\^@~:]\\S*)?$)|(^[0]{40}(:|-)$)/;\nconst revisionWithSuffixRegex = /^\\S+[\\^@~:]\\S*$/;\nconst shaRegex = /(^[0-9a-f]{40}$)|(^[0]{40}(:|-)$)/;\nconst shaShortRegex = /(^[0-9a-f]{7,40}$)|(^[0]{40}(:|-)$)/;\nconst shaParentRegex = /(^[0-9a-f]{40})\\^[0-3]?$/;\nconst shaShortenRegex = /^(.*?)([\\^@~:].*)?$/;\nconst uncommittedRegex = /^[0]{40}(?:[\\^@~:]\\S*)?:?$/;\nconst uncommittedStagedRegex = /^[0]{40}([\\^@~]\\S*)?:$/;\n\nfunction isMatch(regex: RegExp, rev: string | undefined) {\n\treturn !rev ? false : regex.test(rev);\n}\n\n/** Checks if the rev looks like a revision with a navigation suffixes (like ^, @, ~, or :) */\nexport function isRevisionWithSuffix(rev: string): boolean {\n\treturn isMatch(revisionWithSuffixRegex, rev) && rev.length > 40;\n}\n\n/** Checks if the rev looks like a SHA-1 hash\n * @param allowShort If true, allows short SHAs (7-40 characters)\n */\nexport function isSha(rev: string, allowShort: boolean = false): boolean {\n\treturn isMatch(allowShort ? shaShortRegex : shaRegex, rev);\n}\n\n/** Checks if the rev looks like a SHA-1 hash with an optional revision navigation suffixes (like ^, @, ~, or :) */\nexport function isShaWithOptionalRevisionSuffix(rev: string): boolean {\n\treturn isMatch(shaWithOptionalRevisionSuffixRegex, rev);\n}\n\n/** Checks if the rev looks like a SHA-1 hash with a ^ parent suffix */\nexport function isShaWithParentSuffix(rev: string): boolean {\n\treturn isMatch(shaParentRegex, rev);\n}\n\nexport function isUncommitted(rev: string | undefined, exact: boolean = false): boolean {\n\treturn rev === uncommitted || rev === uncommittedStaged || (!exact && isMatch(uncommittedRegex, rev));\n}\n\nexport function isUncommittedStaged(rev: string | undefined, exact: boolean = false): boolean {\n\treturn rev === uncommittedStaged || (!exact && isMatch(uncommittedStagedRegex, rev));\n}\n\nexport function isUncommittedWithParentSuffix(rev: string | undefined): rev is `${typeof uncommitted}${'^' | ':^'}` {\n\treturn rev === `${uncommitted}^` || rev === `${uncommittedStaged}^`;\n}\n\nexport function isUncommittedStagedWithParentSuffix(\n\trev: string | undefined,\n): rev is `${typeof uncommitted}${'^' | ':^'}` {\n\treturn rev === `${uncommittedStaged}^`;\n}\n\nlet abbreviatedShaLength = 7;\nexport function getAbbreviatedShaLength(): number {\n\treturn abbreviatedShaLength;\n}\n\nexport function setAbbreviatedShaLength(length: number): void {\n\tabbreviatedShaLength = length;\n}\n\n/** Resets the abbreviated SHA length to the default (7). For test isolation. */\nexport function resetAbbreviatedShaLength(): void {\n\tabbreviatedShaLength = 7;\n}\n\nexport function shortenRevision(\n\trev: string | undefined,\n\toptions?: {\n\t\tstrings?: { uncommitted?: string; uncommittedStaged?: string; working?: string };\n\t},\n): string {\n\tif (rev === deletedOrMissing) return '(deleted)';\n\tif (!rev) return options?.strings?.working ?? '';\n\tif (isUncommitted(rev)) {\n\t\treturn isUncommittedStaged(rev)\n\t\t\t? (options?.strings?.uncommittedStaged ?? 'Index')\n\t\t\t: (options?.strings?.uncommitted ?? 'Working Tree');\n\t}\n\tif (isRevisionRange(rev) || !isShaWithOptionalRevisionSuffix(rev)) return rev;\n\n\t// Don't allow shas to be shortened to less than 5 characters\n\tconst len = Math.max(5, getAbbreviatedShaLength());\n\n\t// If we have a suffix, append it\n\tconst match = shaShortenRegex.exec(rev);\n\tif (match != null) {\n\t\tconst [, rev, suffix] = match;\n\n\t\tif (suffix != null) {\n\t\t\treturn `${rev.substring(0, len)}${suffix}`;\n\t\t}\n\t}\n\n\treturn rev.substring(0, len);\n}\n\nexport function createRevisionRange(\n\tleft: string | undefined,\n\tright: string | undefined,\n\tnotation: GitRevisionRangeNotation,\n): GitRevisionRange {\n\treturn `${left ?? ''}${notation}${right ?? ''}`;\n}\n\nexport function getRevisionRangeParts(\n\trevRange: GitRevisionRange,\n): { left: string | undefined; right: string | undefined; notation: GitRevisionRangeNotation } | undefined {\n\tconst match = rangeRegex.exec(revRange);\n\tif (match == null) return undefined;\n\n\tconst [, left, notation, right] = match;\n\treturn {\n\t\tleft: left || undefined,\n\t\tright: right || undefined,\n\t\tnotation: notation as GitRevisionRangeNotation,\n\t};\n}\n\nexport function isRevisionRange(\n\trev: string | undefined,\n\trangeType: 'any' | 'qualified' | 'qualified-double-dot' | 'qualified-triple-dot' = 'any',\n): rev is GitRevisionRange {\n\tif (rev == null) return false;\n\n\tswitch (rangeType) {\n\t\tcase 'qualified':\n\t\t\treturn qualifiedRangeRegex.test(rev);\n\t\tcase 'qualified-double-dot':\n\t\t\treturn qualifiedDoubleDotRange.test(rev);\n\t\tcase 'qualified-triple-dot':\n\t\t\treturn qualifiedTripleDotRange.test(rev);\n\t\tdefault:\n\t\t\treturn rangeRegex.test(rev);\n\t}\n}\n\n//** Strips `origin/` from a reference or range, because we \"fake\" origin as the default remote */\nexport function stripOrigin<T extends string | GitRevisionRange | undefined>(ref: T): T {\n\treturn ref?.replace(/(?:^|(?<=..))origin\\//, '') as T;\n}\n\n/** Whether the file at `relativePath` doesn't exist at a resolved revision — nothing touched it yet, or its last change there deleted it or moved it away (a copy is reported instead of a rename when `diff.renames=copies`) */\nexport function isResolvedRevisionMissing(resolved: ResolvedRevision, relativePath: string): boolean {\n\treturn (\n\t\tresolved.sha === deletedOrMissing ||\n\t\tresolved.status === 'D' ||\n\t\t((resolved.status === 'R' || resolved.status === 'C') &&\n\t\t\tresolved.path != null &&\n\t\t\tresolved.path !== relativePath)\n\t);\n}\n"],"mappings":";;AAIA,MAAM,aAAa;AACnB,MAAM,sBAAsB;AAC5B,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,qCAAqC;AAC3C,MAAM,0BAA0B;AAChC,MAAM,WAAW;AACjB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;AACxB,MAAM,mBAAmB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AG,OAAO;CAG1E,MAAM,MAAM,KAAK,IAAI,GAAG,wBAAwB,CAAC;CAGjD,MAAM,QAAQ,gBAAgB,KAAK,GAAG;CACtC,IAAI,SAAS,MAAM;EAClB,MAAM,GAAG,KAAK,UAAU;EAExB,IAAI,UAAU,MACb,OAAO,GAAG,IAAI,UAAU,GAAG,GAAG,IAAI;CAEpC;CAEA,OAAO,IAAI,UAAU,GAAG,GAAG;AAC5B;AAEA,SAAgB,oBACf,MACA,OACA,UACmB;CACnB,OAAO,GAAG,QAAQ,KAAK,WAAW,SAAS;AAC5C;AAEA,SAAgB,sBACf,UAC0G;CAC1G,MAAM,QAAQ,WAAW,KAAK,QAAQ;CACtC,IAAI,SAAS,MAAM,OAAO,KAAA;CAE1B,MAAM,GAAG,MAAM,UAAU,SAAS;CAClC,OAAO;EACN,MAAM,QAAQ,KAAA;EACd,OAAO,SAAS,KAAA;EACN;CACX;AACD;AAEA,SAAgB,gBACf,KACA,YAAmF,OACzD;CAC1B,IAAI,OAAO,MAAM,OAAO;CAExB,QAAQ,WAAR;EACC,KAAK,aACJ,OAAO,oBAAoB,KAAK,GAAG;EACpC,KAAK,wBACJ,OAAO,wBAAwB,KAAK,GAAG;EACxC,KAAK,wBACJ,OAAO,wBAAwB,KAAK,GAAG;EACxC,SACC,OAAO,WAAW,KAAK,GAAG;CAC5B;AACD;AAGA,SAAgB,YAA6D,KAAW;CACvF,OAAO,KAAK,QAAQ,yBAAyB,EAAE;AAChD;;AAGA,SAAgB,0BAA0B,UAA4B,cAA+B;CACpG,OACC,SAAS,QAAA,+CACT,SAAS,WAAW,QAClB,SAAS,WAAW,OAAO,SAAS,WAAW,QAChD,SAAS,QAAQ,QACjB,SAAS,SAAS;AAErB"}
@@ -201,6 +201,10 @@ export declare class GitHubApi {
201
201
  limit?: number;
202
202
  }): Promise<PagedResult<GitHubTag>>;
203
203
  resolveReference(token: GitHubTokenInfo, owner: string, repo: string, ref: string, path?: string): Promise<string | undefined>;
204
+ resolveReferenceForPath(token: GitHubTokenInfo, owner: string, repo: string, ref: string, path: string): Promise<{
205
+ sha: string;
206
+ exists: boolean;
207
+ } | undefined>;
204
208
  searchCommits(token: GitHubTokenInfo, query: string, options?: {
205
209
  cursor?: string;
206
210
  limit?: number;
@@ -1619,8 +1619,9 @@ var GitHubApi = class {
1619
1619
  }
1620
1620
  async resolveReference(token, owner, repo, ref, path) {
1621
1621
  const scope = getScopedLogger();
1622
+ if (path) return (await this.resolveReferenceForPath(token, owner, repo, ref, path))?.sha;
1622
1623
  try {
1623
- if (!path) return (await this.graphql(void 0, token, `query resolveReference(
1624
+ return (await this.graphql(void 0, token, `query resolveReference(
1624
1625
  $owner: String!
1625
1626
  $repo: String!
1626
1627
  $ref: String!
@@ -1635,11 +1636,20 @@ var GitHubApi = class {
1635
1636
  repo,
1636
1637
  ref
1637
1638
  }, scope))?.repository?.object?.oid ?? void 0;
1638
- return (await this.graphql(void 0, token, `query resolveReference(
1639
+ } catch (ex) {
1640
+ if (ex instanceof RequestNotFoundError) return void 0;
1641
+ throw this.handleException(ex, void 0, scope);
1642
+ }
1643
+ }
1644
+ async resolveReferenceForPath(token, owner, repo, ref, path) {
1645
+ const scope = getScopedLogger();
1646
+ try {
1647
+ const rsp = await this.graphql(void 0, token, `query resolveReferenceForPath(
1639
1648
  $owner: String!
1640
1649
  $repo: String!
1641
1650
  $ref: String!
1642
1651
  $path: String!
1652
+ $refPath: String!
1643
1653
  ) {
1644
1654
  repository(owner: $owner, name: $repo) {
1645
1655
  object(expression: $ref) {
@@ -1649,13 +1659,23 @@ var GitHubApi = class {
1649
1659
  }
1650
1660
  }
1651
1661
  }
1662
+ file: object(expression: $refPath) {
1663
+ oid
1664
+ }
1652
1665
  }
1653
1666
  }`, {
1654
1667
  owner,
1655
1668
  repo,
1656
1669
  ref,
1657
- path
1658
- }, scope))?.repository?.object?.history.nodes?.[0]?.oid ?? void 0;
1670
+ path,
1671
+ refPath: `${ref}:${path}`
1672
+ }, scope);
1673
+ const sha = rsp?.repository?.object?.history.nodes?.[0]?.oid;
1674
+ if (sha == null) return void 0;
1675
+ return {
1676
+ sha,
1677
+ exists: rsp?.repository?.file != null
1678
+ };
1659
1679
  } catch (ex) {
1660
1680
  if (ex instanceof RequestNotFoundError) return void 0;
1661
1681
  throw this.handleException(ex, void 0, scope);
@@ -3411,6 +3431,13 @@ __decorate([trace({ args: (token, owner, repo, ref, path) => ({
3411
3431
  ref,
3412
3432
  path
3413
3433
  }) })], GitHubApi.prototype, "resolveReference", null);
3434
+ __decorate([trace({ args: (token, owner, repo, ref, path) => ({
3435
+ token: `<token:${token.microHash}>`,
3436
+ owner,
3437
+ repo,
3438
+ ref,
3439
+ path
3440
+ }) })], GitHubApi.prototype, "resolveReferenceForPath", null);
3414
3441
  __decorate([trace({ args: (token, query) => ({
3415
3442
  token: `<token:${token.microHash}>`,
3416
3443
  query