@gitkraken/core-gitlens 0.31.0 → 0.33.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 +41 -1
- package/dist/git/cache.d.ts +90 -15
- package/dist/git/cache.js +215 -44
- package/dist/git/cache.js.map +1 -1
- package/dist/git/models/repositoryIdentities.d.ts +0 -1
- package/dist/git/models/repositoryIdentities.js +1 -4
- package/dist/git/models/repositoryIdentities.js.map +1 -1
- package/dist/git/providers/config.d.ts +8 -0
- package/dist/git/providers/provider.d.ts +7 -0
- package/dist/git/remotes/gitlab.js +15 -9
- package/dist/git/remotes/gitlab.js.map +1 -1
- package/dist/git/service.d.ts +2 -1
- package/dist/git/service.js +6 -2
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/repository.utils.d.ts +10 -0
- package/dist/git/utils/repository.utils.js +25 -2
- package/dist/git/utils/repository.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +13 -3
- package/dist/git/watching/changeEvent.js +19 -4
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts +4 -2
- package/dist/git/watching/watchGroup.js +32 -17
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +4 -1
- package/dist/git/watching/watchService.js +18 -15
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +27 -12
- package/dist/git/watching/watchSession.js +49 -19
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +3 -2
- package/dist/git/watching/worktreeSummary.js +11 -10
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +28 -2
- package/dist/git-cli/cliGitProvider.js +63 -20
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +17 -1
- package/dist/git-cli/exec/git.js +55 -8
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +2 -0
- package/dist/git-cli/exec/indexLock.js +2 -2
- package/dist/git-cli/exec/indexLock.js.map +1 -1
- package/dist/git-cli/providers/branches.js +15 -10
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +6 -1
- package/dist/git-cli/providers/config.js +49 -48
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +7 -3
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/worktrees.js +34 -10
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.js +1 -1
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/integrations/models/integration.js +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +10 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js +62 -15
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +8 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js +32 -16
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/package.json +1 -1
package/dist/git-cli/exec/git.js
CHANGED
|
@@ -16,6 +16,7 @@ import { GitQueue, getPrimaryGitCommand, inferGitCommandPriority } from "./gitQu
|
|
|
16
16
|
import { getMovedHead } from "./headState.js";
|
|
17
17
|
import { KeyedSequencer, isConfigCommand, isIndexWriteCommand, retryWhileConfigLocked, retryWhileIndexLocked, toExitCode } from "./indexLock.js";
|
|
18
18
|
import { resolve } from "path";
|
|
19
|
+
import { stat } from "fs/promises";
|
|
19
20
|
import * as process from "process";
|
|
20
21
|
//#region ../git-cli/src/exec/git.ts
|
|
21
22
|
const slowCallWarningThreshold = 2e3;
|
|
@@ -174,6 +175,35 @@ var GitError = class extends Error {
|
|
|
174
175
|
Error.captureStackTrace?.(this, new.target);
|
|
175
176
|
}
|
|
176
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* Whether a failed `rev-parse` is git's own answer, where one killed, cut short or never started says nothing. Only
|
|
180
|
+
* for `rev-parse`, which fails only by dying: any other code came from around git, a wrapper reporting a kill (137), or
|
|
181
|
+
* Windows, where a killed process reports 1. Other commands exit 1 as an answer (`config --get`, `diff --quiet`).
|
|
182
|
+
*/
|
|
183
|
+
function isGitAnswer(ex) {
|
|
184
|
+
return ex instanceof GitError && ex.exitCode === 128;
|
|
185
|
+
}
|
|
186
|
+
/** Whether a `rev-parse` failed without an answer from git (see {@link isGitAnswer}), so says nothing about its path */
|
|
187
|
+
function isGitUnanswered(ex) {
|
|
188
|
+
return isCancellationError(ex) || ex instanceof GitError && !isGitAnswer(ex);
|
|
189
|
+
}
|
|
190
|
+
/** Rejects an `errors: 'ignore'` `rev-parse` that gave no answer (see {@link isGitAnswer}), whose empty output would read as one */
|
|
191
|
+
function throwIfUnanswered(result) {
|
|
192
|
+
const { completion } = result;
|
|
193
|
+
if (completion.status === "cancelled") throw new CancellationError(completion.error, completion.reason);
|
|
194
|
+
if (completion.status === "failed") throw new GitError(completion.error);
|
|
195
|
+
if (completion.status === "exited" && completion.code !== 0 && completion.code !== 128) throw new GitError(new RunError({
|
|
196
|
+
message: `Command exited with code ${completion.code}`,
|
|
197
|
+
code: completion.code
|
|
198
|
+
}, "", result.stderr ?? ""));
|
|
199
|
+
}
|
|
200
|
+
async function isFolder(path) {
|
|
201
|
+
try {
|
|
202
|
+
return (await stat(path)).isDirectory();
|
|
203
|
+
} catch {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
177
207
|
const errorToReasonMap = /* @__PURE__ */ new Map([
|
|
178
208
|
["branch", [
|
|
179
209
|
[GitErrors.branchAlreadyExists, "alreadyExists"],
|
|
@@ -585,8 +615,13 @@ var Git = class {
|
|
|
585
615
|
_gitLocationPromise;
|
|
586
616
|
async getLocation() {
|
|
587
617
|
if (this._gitLocation == null) {
|
|
588
|
-
this._gitLocationPromise ??= this._locator();
|
|
589
|
-
|
|
618
|
+
const promise = this._gitLocationPromise ??= this._locator();
|
|
619
|
+
try {
|
|
620
|
+
this._gitLocation = await promise;
|
|
621
|
+
} catch (ex) {
|
|
622
|
+
if (this._gitLocationPromise === promise) this._gitLocationPromise = void 0;
|
|
623
|
+
throw ex;
|
|
624
|
+
}
|
|
590
625
|
}
|
|
591
626
|
return this._gitLocation;
|
|
592
627
|
}
|
|
@@ -766,6 +801,7 @@ var Git = class {
|
|
|
766
801
|
let hookFailure;
|
|
767
802
|
let waiting;
|
|
768
803
|
let promise;
|
|
804
|
+
const gitPath = await this.path();
|
|
769
805
|
const pending = this.pendingCommands.get(cacheKey);
|
|
770
806
|
if (pending == null) {
|
|
771
807
|
waiting = false;
|
|
@@ -784,7 +820,6 @@ var Git = class {
|
|
|
784
820
|
if (process.platform === "win32") args.unshift("-c", "core.longpaths=true");
|
|
785
821
|
if (cancellation != null) runOpts.cancellation = cancellation;
|
|
786
822
|
const priority = options.priority ?? inferGitCommandPriority(args);
|
|
787
|
-
const gitPath = await this.path();
|
|
788
823
|
const spawnQueued = () => this._queue.run(priority, () => {
|
|
789
824
|
execStart = hrtime();
|
|
790
825
|
if (!command.spawned) {
|
|
@@ -1055,6 +1090,10 @@ var Git = class {
|
|
|
1055
1090
|
}
|
|
1056
1091
|
return { path: dotGitPath };
|
|
1057
1092
|
}
|
|
1093
|
+
/**
|
|
1094
|
+
* `[]` when git says `cwd` isn't a repository it can use, or `cwd` is a file; a missing `cwd` answers for the nearest
|
|
1095
|
+
* folder above it. Rejects when git gives no answer (see {@link isGitAnswer}), which says nothing about `cwd`.
|
|
1096
|
+
*/
|
|
1058
1097
|
async rev_parse__show_toplevel(cwd) {
|
|
1059
1098
|
let result;
|
|
1060
1099
|
if (this.options.isTrusted?.() === false) {
|
|
@@ -1079,6 +1118,7 @@ var Git = class {
|
|
|
1079
1118
|
} catch (ex) {
|
|
1080
1119
|
if (ex instanceof WorkspaceUntrustedError) return emptyArray;
|
|
1081
1120
|
if (!(ex instanceof GitError)) throw ex;
|
|
1121
|
+
if (!isGitAnswer(ex) && await isFolder(cwd)) throw ex;
|
|
1082
1122
|
const unsafeMatch = GitErrors.unsafeRepository.exec(ex.stderr ?? "");
|
|
1083
1123
|
if (unsafeMatch != null) {
|
|
1084
1124
|
_logger.warn(`Skipping; unsafe repository detected in '${unsafeMatch[1] || unsafeMatch[2]}'; run '${unsafeMatch[3]}' to allow it`);
|
|
@@ -1090,8 +1130,12 @@ var Git = class {
|
|
|
1090
1130
|
cwd,
|
|
1091
1131
|
errors: "ignore"
|
|
1092
1132
|
}, "rev-parse", "--is-bare-repository");
|
|
1133
|
+
throwIfUnanswered(result);
|
|
1093
1134
|
if (result.stdout.trim() === "true") {
|
|
1094
|
-
const result = await this.rev_parse__git_dir(cwd).catch(() =>
|
|
1135
|
+
const result = await this.rev_parse__git_dir(cwd).catch((ex) => {
|
|
1136
|
+
if (isGitAnswer(ex)) return void 0;
|
|
1137
|
+
throw ex;
|
|
1138
|
+
});
|
|
1095
1139
|
const repoPath = result?.commonPath ?? result?.path;
|
|
1096
1140
|
if (repoPath?.length) return [true, await this.rev_parse__work_tree_of_git_dir(repoPath) ?? repoPath];
|
|
1097
1141
|
}
|
|
@@ -1112,16 +1156,19 @@ var Git = class {
|
|
|
1112
1156
|
}
|
|
1113
1157
|
}
|
|
1114
1158
|
/**
|
|
1115
|
-
* Returns the working tree in `gitDir`'s parent folder that uses `gitDir` as its git dir, if any.
|
|
1159
|
+
* Returns the working tree in `gitDir`'s parent folder that uses `gitDir` as its git dir, if any. Rejects when git
|
|
1160
|
+
* gives no answer (see {@link isGitAnswer}), rather than calling `gitDir` a bare repository.
|
|
1116
1161
|
* Inside the git dir of a non-bare repo whose config lacks `core.bare`, git guesses the repo is bare
|
|
1117
1162
|
*/
|
|
1118
1163
|
async rev_parse__work_tree_of_git_dir(gitDir) {
|
|
1119
1164
|
const parent = dirname$1(gitDir);
|
|
1120
1165
|
if (parent === gitDir) return void 0;
|
|
1121
|
-
const
|
|
1166
|
+
const result = await this.run({
|
|
1122
1167
|
cwd: parent,
|
|
1123
1168
|
errors: "ignore"
|
|
1124
|
-
}, "rev-parse", "--show-toplevel", "--git-dir")
|
|
1169
|
+
}, "rev-parse", "--show-toplevel", "--git-dir");
|
|
1170
|
+
throwIfUnanswered(result);
|
|
1171
|
+
const [toplevel, parentGitDir] = result.stdout.split("\n").map((r) => r.trimStart());
|
|
1125
1172
|
if (!toplevel || !parentGitDir) return void 0;
|
|
1126
1173
|
if (!arePathsEqual(isAbsolute$1(parentGitDir) ? parentGitDir : joinPaths(parent, parentGitDir), gitDir)) return;
|
|
1127
1174
|
return normalizePath(toplevel);
|
|
@@ -1188,6 +1235,6 @@ function defaultExceptionHandler(ex, cwd, start) {
|
|
|
1188
1235
|
throw ex;
|
|
1189
1236
|
}
|
|
1190
1237
|
//#endregion
|
|
1191
|
-
export { Git, GitError, GitErrors, GitWarnings, batchLiteralPathspecs, classifySearchError, classifySigningError, defaultExceptionHandler, getGitCommandError, gitConfigsBranch, gitConfigsDiff, gitConfigsLog, gitConfigsLogWithFiles, gitConfigsLogWithSignatures, gitConfigsPull, gitConfigsStatus, inferSigningFormatFromError, isRunHookFailure, maxGitCliLength, slowCallWarningThreshold };
|
|
1238
|
+
export { Git, GitError, GitErrors, GitWarnings, batchLiteralPathspecs, classifySearchError, classifySigningError, defaultExceptionHandler, getGitCommandError, gitConfigsBranch, gitConfigsDiff, gitConfigsLog, gitConfigsLogWithFiles, gitConfigsLogWithSignatures, gitConfigsPull, gitConfigsStatus, inferSigningFormatFromError, isFolder, isGitAnswer, isGitUnanswered, isRunHookFailure, maxGitCliLength, slowCallWarningThreshold, throwIfUnanswered };
|
|
1192
1239
|
|
|
1193
1240
|
//# sourceMappingURL=git.js.map
|