@gitkraken/core-gitlens 0.9.9 → 0.10.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 CHANGED
@@ -6,6 +6,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.10.0] - 2026-10-04
10
+
11
+ ### Added
12
+
13
+ - Adds `expectedExitCodes` to `Git.run`'s options: non-zero exit codes that are answers rather than failures, such as `1` from `git diff --quiet`, resolve as `exited` with that code in every `errors` mode, so a read can run with `errors: 'throw'` and still get its answer (git, git-cli)
14
+ - Adds `reason` (`'aborted'`, `'timeout'` or `'unknown'`) to `CancellationError` and `CancelledRunError`, read from how the process ended rather than estimated from its duration, so a consumer can tell a git timeout from a caller abort. A timeout is still a `CancellationError`, and the `reason` on a cancelled `completion` is now exact as well (utils, git, git-cli)
15
+ - Adds `getGitWarning` and `undefinedOnGitWarning` to the git errors module, for a caller that wants the old answer for a read that now rejects: `.catch(undefinedOnGitWarning)` resolves `undefined` when git reported a known warning (a folder that is no longer a repository, a bare repository) and rethrows any other failure, including a cancellation or timeout (git)
16
+
17
+ ### Changed
18
+
19
+ - **Breaking (git, git-cli)** — `status.getStatus`, `getUntrackedFiles`, `getConflictingFiles`, `hasConflictingFiles`, `getWorkingChangesState` and `hasWorkingChanges` reject when git fails, with a `GitError` carrying git's `stderr`, where they used to answer empty or `false`; an empty or `false` answer now always means git ran and found nothing. Cancellation still rejects with `CancellationError`. `hasWorkingChanges`'s `throwOnError` option is removed (it could not surface a git failure anyway), so catch the rejection where a fallback is wanted. `getStatus` rejects where it used to resolve `undefined` (a folder that is no longer a repository, a bare repository), while `getStatusForFile` and `getStatusForPath` still resolve `undefined` there. `diff.getDiffStatus` and `getChangedFilesCount` with `includeUntracked` still leave untracked files out when the listing fails, unless called with `errors: 'throw'`, which now rejects for it too
20
+
21
+ ### Fixed
22
+
23
+ - Fixes `hasWorkingChanges` reporting a repository with no commits as clean when it has staged or modified files: before the first commit it compares against the empty tree (git-cli)
24
+
9
25
  ## [0.9.9] - 2026-10-04
10
26
 
11
27
  ### Changed
@@ -543,7 +559,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
543
559
 
544
560
  - 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.
545
561
 
546
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.9...HEAD
562
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.0...HEAD
563
+ [0.10.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.9...gitkraken:releases/core/v0.10.0
547
564
  [0.9.9]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.8...gitkraken:releases/core/v0.9.9
548
565
  [0.9.8]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.7...gitkraken:releases/core/v0.9.8
549
566
  [0.9.7]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.9.6...gitkraken:releases/core/v0.9.7
@@ -32,6 +32,13 @@ export declare const GitWarnings: {
32
32
  readonly tipBehind: RegExp;
33
33
  };
34
34
  export type GitWarningKey = keyof typeof GitWarnings;
35
+ /** The {@link GitWarnings} entry a failure's message matches, if any */
36
+ export declare function getGitWarning(ex: unknown): GitWarningKey | undefined;
37
+ /**
38
+ * For a read's `.catch`: answers `undefined` for a {@link GitWarnings} failure (a folder that is no longer a repository,
39
+ * a bare repository) and rethrows any other, including a cancellation or timeout
40
+ */
41
+ export declare function undefinedOnGitWarning(ex: unknown): undefined;
35
42
  export interface GitCommandContext {
36
43
  readonly repoPath: string;
37
44
  readonly args: readonly (string | undefined)[];
@@ -38,6 +38,19 @@ const GitWarnings = {
38
38
  notAGitCommand: /'.+' is not a git command/i,
39
39
  tipBehind: /tip of your current branch is behind/i
40
40
  };
41
+ /** The {@link GitWarnings} entry a failure's message matches, if any */
42
+ function getGitWarning(ex) {
43
+ if (!(ex instanceof Error)) return void 0;
44
+ for (const [key, warning] of Object.entries(GitWarnings)) if (warning.test(ex.message)) return key;
45
+ }
46
+ /**
47
+ * For a read's `.catch`: answers `undefined` for a {@link GitWarnings} failure (a folder that is no longer a repository,
48
+ * a bare repository) and rethrows any other, including a cancellation or timeout
49
+ */
50
+ function undefinedOnGitWarning(ex) {
51
+ if (getGitWarning(ex) != null) return void 0;
52
+ throw ex;
53
+ }
41
54
  var GitCommandError = class GitCommandError extends Error {
42
55
  static is(ex) {
43
56
  return ex instanceof GitCommandError;
@@ -979,6 +992,6 @@ var SigningError = class SigningError extends GitCommandError {
979
992
  }
980
993
  };
981
994
  //#endregion
982
- export { ApplyPatchCommitError, AuthenticationError, AuthenticationErrorReason, BlameIgnoreRevsFileBadRevisionError, BlameIgnoreRevsFileError, BranchError, CheckoutError, CherryPickError, CommitError, FetchError, GitCommandError, GitSearchError, GitWarnings, MergeError, PausedOperationAbortError, PausedOperationContinueError, PullError, PushError, RebaseError, ReferenceUpdateError, RequestClientError, RequestNotFoundError, RequestRateLimitError, ResetError, RevertError, ShowError, SigningError, StashApplyError, StashPushError, TagError, WorkspaceUntrustedError, WorktreeCreateError, WorktreeDeleteError, getDeferredRequestFailure, reportRequestFailure };
995
+ export { ApplyPatchCommitError, AuthenticationError, AuthenticationErrorReason, BlameIgnoreRevsFileBadRevisionError, BlameIgnoreRevsFileError, BranchError, CheckoutError, CherryPickError, CommitError, FetchError, GitCommandError, GitSearchError, GitWarnings, MergeError, PausedOperationAbortError, PausedOperationContinueError, PullError, PushError, RebaseError, ReferenceUpdateError, RequestClientError, RequestNotFoundError, RequestRateLimitError, ResetError, RevertError, ShowError, SigningError, StashApplyError, StashPushError, TagError, WorkspaceUntrustedError, WorktreeCreateError, WorktreeDeleteError, getDeferredRequestFailure, getGitWarning, reportRequestFailure, undefinedOnGitWarning };
983
996
 
984
997
  //# sourceMappingURL=errors.js.map