@gitkraken/core-gitlens 0.37.0 → 0.38.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 +67 -1
- package/dist/git/cache.d.ts +128 -8
- package/dist/git/cache.js +425 -46
- package/dist/git/cache.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +3 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/providers/branches.d.ts +42 -1
- package/dist/git/providers/diff.d.ts +17 -0
- package/dist/git/providers/provider.d.ts +7 -0
- package/dist/git/providers/shared/remotes.js +8 -4
- package/dist/git/providers/shared/remotes.js.map +1 -1
- package/dist/git/remotes/matcher.js +2 -2
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/repositoryService.d.ts +16 -1
- package/dist/git/repositoryService.js +51 -3
- package/dist/git/repositoryService.js.map +1 -1
- package/dist/git/run.types.d.ts +1 -0
- package/dist/git/service.js +6 -2
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/fileStatus.utils.d.ts +5 -0
- package/dist/git/utils/fileStatus.utils.js +18 -1
- package/dist/git/utils/fileStatus.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +13 -3
- package/dist/git/watching/changeEvent.js +15 -4
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/changeOrdinal.d.ts +9 -0
- package/dist/git/watching/changeOrdinal.js +14 -0
- package/dist/git/watching/changeOrdinal.js.map +1 -0
- package/dist/git/watching/unwatchedCacheValidator.d.ts +38 -5
- package/dist/git/watching/unwatchedCacheValidator.js +180 -36
- package/dist/git/watching/unwatchedCacheValidator.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts +63 -14
- package/dist/git/watching/watchGroup.js +213 -74
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.js +4 -3
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +10 -2
- package/dist/git/watching/watchSession.js +18 -4
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +18 -4
- package/dist/git/watching/watcherPatterns.js +39 -8
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +23 -12
- package/dist/git/watching/worktreeSummary.js +164 -41
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +1 -0
- package/dist/git-cli/cliGitProvider.js +11 -2
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +7 -2
- package/dist/git-cli/exec/git.js +46 -10
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/headState.d.ts +24 -0
- package/dist/git-cli/exec/headState.js +46 -6
- package/dist/git-cli/exec/headState.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +6 -3
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +135 -10
- package/dist/git-cli/providers/branches.js +622 -80
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +16 -0
- package/dist/git-cli/providers/commits.js +80 -28
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +10 -0
- package/dist/git-cli/providers/config.js +50 -12
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.js +11 -7
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts +12 -0
- package/dist/git-cli/providers/diff.js +107 -15
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.js +32 -25
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +37 -3
- package/dist/git-cli/providers/operations.js +124 -46
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.js +1 -1
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +1 -1
- package/dist/git-cli/providers/refs.js +10 -11
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +4 -5
- package/dist/git-cli/providers/status.js +36 -33
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts +8 -0
- package/dist/git-cli/providers/tags.js +53 -34
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/service.d.ts +15 -0
- package/dist/git-cli/service.js +19 -1
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +4 -0
- package/dist/plus/git-github/api/github.js +11 -1
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts +1 -0
- package/dist/plus/git-github/providers/github/diff.js +6 -1
- package/dist/plus/git-github/providers/github/diff.js.map +1 -1
- package/dist/plus/integrations/integrationService.js +9 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/providers/jira-server.js +1 -1
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +38 -6
- package/dist/plus/integrations/providers/jira.js +111 -69
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +31 -3
- package/dist/plus/integrations/providers/linear.js +77 -18
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +41 -4
- package/dist/plus/integrations/providers/utils/discoveryCache.js +50 -11
- package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +5 -4
- package/dist/utils/env/node/exec.js +52 -9
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/holdOffMap.d.ts +23 -0
- package/dist/utils/holdOffMap.js +43 -0
- package/dist/utils/holdOffMap.js.map +1 -0
- package/dist/utils/promiseCache.d.ts +15 -2
- package/dist/utils/promiseCache.js +34 -4
- package/dist/utils/promiseCache.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ import { DeprecatedGkConfigKeys, GitConfigKeys, GitConfigSubProvider, GitConfigT
|
|
|
7
7
|
import { Git } from "../exec/git.js";
|
|
8
8
|
import { CliGitProviderInternal } from "../cliGitProvider.js";
|
|
9
9
|
//#region ../git-cli/src/providers/config.d.ts
|
|
10
|
+
/** The clock a failed current-user read's wait is measured on, exported for testing */
|
|
11
|
+
export declare const currentUserReadClock: {
|
|
12
|
+
now: () => number;
|
|
13
|
+
};
|
|
10
14
|
/** The wall clock a read's fingerprint is checked against (see {@link isGkConfigStatRacy}), exported for testing */
|
|
11
15
|
export declare const gkConfigFingerprintClock: {
|
|
12
16
|
now: () => number;
|
|
@@ -73,6 +77,11 @@ export declare class ConfigGitSubProvider implements GitConfigSubProvider {
|
|
|
73
77
|
private readonly cache;
|
|
74
78
|
private readonly provider;
|
|
75
79
|
constructor(context: GitServiceContext, git: Git, cache: Cache, provider: CliGitProviderInternal);
|
|
80
|
+
/**
|
|
81
|
+
* Failed reads of the current user by repository path, each with the drop stamp taken before it. Not a cached answer:
|
|
82
|
+
* it only holds git off for a while, and a drop of the path's user (a config change, close or reset) ends it
|
|
83
|
+
*/
|
|
84
|
+
private readonly failedUserReads;
|
|
76
85
|
/**
|
|
77
86
|
* In-flight gk-config reconciles keyed by commonPath. `pending` records that another `'gkConfig'`
|
|
78
87
|
* event landed mid-pass, so one trailing pass runs after the current one settles. `paths` holds every
|
|
@@ -103,6 +112,7 @@ export declare class ConfigGitSubProvider implements GitConfigSubProvider {
|
|
|
103
112
|
ignoreCase: string | undefined;
|
|
104
113
|
}>;
|
|
105
114
|
private readIgnoreConfigListing;
|
|
115
|
+
/** Rejects when git couldn't read the configuration; a read that matched no key is an empty map */
|
|
106
116
|
getConfigRegex(repoPath: string | undefined, pattern: string, options?: {
|
|
107
117
|
global?: boolean;
|
|
108
118
|
runGitLocally?: boolean;
|
|
@@ -13,6 +13,7 @@ import { fsExists } from "../../utils/env/node/exec.js";
|
|
|
13
13
|
import { isGitDirMovedByEnv, readGitDirs, readGitDirsOrReject } from "../exec/gitDirResolver.js";
|
|
14
14
|
import { KeyedSequencer } from "../exec/indexLock.js";
|
|
15
15
|
import { isFolder, isGitAnswer, isGitUnanswered, throwIfUnanswered } from "../exec/git.js";
|
|
16
|
+
import { HoldOffMap } from "../../utils/holdOffMap.js";
|
|
16
17
|
import { gate } from "../../utils/decorators/gate.js";
|
|
17
18
|
import { promises, statSync } from "fs";
|
|
18
19
|
import { env } from "process";
|
|
@@ -20,6 +21,10 @@ import { hostname, userInfo } from "os";
|
|
|
20
21
|
//#region ../git-cli/src/providers/config.ts
|
|
21
22
|
const mappedAuthorRegex = /(.+)\s<(.+)>/;
|
|
22
23
|
const emptyArray = Object.freeze([]);
|
|
24
|
+
/** How long after a failed read of the current user git isn't run again to read it */
|
|
25
|
+
const failedCurrentUserReadWait = 6e4;
|
|
26
|
+
/** The clock a failed current-user read's wait is measured on, exported for testing */
|
|
27
|
+
const currentUserReadClock = { now: () => Date.now() };
|
|
23
28
|
/** Catch-all pattern matching every key in `.git/gk/config` for the one-shot bulk read. */
|
|
24
29
|
const gkConfigAllPattern = ".";
|
|
25
30
|
/**
|
|
@@ -189,6 +194,11 @@ var ConfigGitSubProvider = class {
|
|
|
189
194
|
this.cache.setGkConfigReconciler((repoPath, priorSnapshot) => this.reconcileGkConfig(repoPath, priorSnapshot));
|
|
190
195
|
}
|
|
191
196
|
/**
|
|
197
|
+
* Failed reads of the current user by repository path, each with the drop stamp taken before it. Not a cached answer:
|
|
198
|
+
* it only holds git off for a while, and a drop of the path's user (a config change, close or reset) ends it
|
|
199
|
+
*/
|
|
200
|
+
failedUserReads = new HoldOffMap(failedCurrentUserReadWait, 256, currentUserReadClock);
|
|
201
|
+
/**
|
|
192
202
|
* In-flight gk-config reconciles keyed by commonPath. `pending` records that another `'gkConfig'`
|
|
193
203
|
* event landed mid-pass, so one trailing pass runs after the current one settles. `paths` holds every
|
|
194
204
|
* worktree path that reported the change, mapped to its close generation at that moment — the pass
|
|
@@ -255,6 +265,7 @@ var ConfigGitSubProvider = class {
|
|
|
255
265
|
}
|
|
256
266
|
return result.stdout;
|
|
257
267
|
}
|
|
268
|
+
/** Rejects when git couldn't read the configuration; a read that matched no key is an empty map */
|
|
258
269
|
getConfigRegex(repoPath, pattern, options) {
|
|
259
270
|
const global = options?.global || repoPath == null;
|
|
260
271
|
return this.cache.getConfigRegex(global ? void 0 : repoPath, pattern, () => this.getConfigRegexCore(repoPath, pattern, options));
|
|
@@ -281,11 +292,13 @@ var ConfigGitSubProvider = class {
|
|
|
281
292
|
if (options?.file) args.push("-f", options.file);
|
|
282
293
|
else if (options?.global || repoPath == null) args.push("--global");
|
|
283
294
|
args.push(pattern);
|
|
284
|
-
|
|
295
|
+
const result = await this.git.run({
|
|
285
296
|
cwd: repoPath ?? "",
|
|
286
297
|
errors: "ignore",
|
|
287
298
|
runLocally: options?.runGitLocally
|
|
288
|
-
}, ...args)
|
|
299
|
+
}, ...args);
|
|
300
|
+
if (result.completion.status !== "exited" || result.exitCode !== 0 && result.exitCode !== 1) throw new Error(`Unable to read the config keys matching '${pattern}'`);
|
|
301
|
+
return parseConfigRegexOutput(result.stdout);
|
|
289
302
|
}
|
|
290
303
|
async setConfig(repoPath, key, value, options) {
|
|
291
304
|
await this.setConfigCore(repoPath, key, value, options);
|
|
@@ -319,6 +332,11 @@ var ConfigGitSubProvider = class {
|
|
|
319
332
|
const cached = this.cache.currentUser.get(repoPath);
|
|
320
333
|
if (cached != null) return cached;
|
|
321
334
|
if (cached === null) return void 0;
|
|
335
|
+
const failedDropStamp = this.failedUserReads.get(repoPath);
|
|
336
|
+
if (failedDropStamp != null) {
|
|
337
|
+
if (!this.cache.isDroppedSince("currentUser", repoPath, failedDropStamp)) return void 0;
|
|
338
|
+
this.failedUserReads.release(repoPath);
|
|
339
|
+
}
|
|
322
340
|
return this.readCurrentUser(repoPath, this.cache.getDropStamp("currentUser", repoPath), scope);
|
|
323
341
|
}
|
|
324
342
|
async readCurrentUser(repoPath, dropStamp, scope) {
|
|
@@ -331,11 +349,12 @@ var ConfigGitSubProvider = class {
|
|
|
331
349
|
};
|
|
332
350
|
try {
|
|
333
351
|
const configMap = await this.getConfigRegex(repoPath, "^user\\.(name|email)$", { runGitLocally: true });
|
|
352
|
+
this.failedUserReads.release(repoPath);
|
|
334
353
|
if (configMap.size) {
|
|
335
354
|
user.name = configMap.get("user.name");
|
|
336
355
|
user.email = configMap.get("user.email");
|
|
337
356
|
} else {
|
|
338
|
-
user.name = env.GIT_AUTHOR_NAME || env.GIT_COMMITTER_NAME ||
|
|
357
|
+
user.name = env.GIT_AUTHOR_NAME || env.GIT_COMMITTER_NAME || getOsUsername() || void 0;
|
|
339
358
|
if (!user.name) {
|
|
340
359
|
setCachedUser(null);
|
|
341
360
|
return;
|
|
@@ -355,8 +374,8 @@ var ConfigGitSubProvider = class {
|
|
|
355
374
|
return user;
|
|
356
375
|
} catch (ex) {
|
|
357
376
|
if (ex instanceof WorkspaceUntrustedError) return void 0;
|
|
377
|
+
if (!this.cache.isDroppedSince("currentUser", repoPath, dropStamp)) this.failedUserReads.hold(repoPath, dropStamp);
|
|
358
378
|
scope?.error(ex);
|
|
359
|
-
setCachedUser(null);
|
|
360
379
|
return;
|
|
361
380
|
}
|
|
362
381
|
}
|
|
@@ -704,7 +723,15 @@ var ConfigGitSubProvider = class {
|
|
|
704
723
|
}
|
|
705
724
|
}
|
|
706
725
|
async getSigningConfig(repoPath) {
|
|
707
|
-
const
|
|
726
|
+
const scope = getScopedLogger();
|
|
727
|
+
let configMap;
|
|
728
|
+
try {
|
|
729
|
+
configMap = await this.getConfigRegex(repoPath, "^(commit\\.gpgsign|gpg\\.format|user\\.signingkey|gpg\\.program|gpg\\.ssh\\.program|gpg\\.ssh\\.allowedsignersfile)$");
|
|
730
|
+
} catch (ex) {
|
|
731
|
+
if (ex instanceof WorkspaceUntrustedError) throw ex;
|
|
732
|
+
scope?.error(ex);
|
|
733
|
+
configMap = /* @__PURE__ */ new Map();
|
|
734
|
+
}
|
|
708
735
|
const enabledRaw = configMap.get("commit.gpgsign");
|
|
709
736
|
const format = configMap.get("gpg.format");
|
|
710
737
|
const signingKey = configMap.get("user.signingkey");
|
|
@@ -881,12 +908,6 @@ var ConfigGitSubProvider = class {
|
|
|
881
908
|
this._migratedRepos.add(repoPath);
|
|
882
909
|
return;
|
|
883
910
|
} catch {}
|
|
884
|
-
if (!await this.ensureGkConfigFolder(gkConfigFolder, scope)) return;
|
|
885
|
-
try {
|
|
886
|
-
await promises.writeFile(gkConfigPath, /* @__PURE__ */ new Uint8Array());
|
|
887
|
-
} catch (ex) {
|
|
888
|
-
scope?.error(ex, `Failed to create '${gkConfigPath}' file`);
|
|
889
|
-
}
|
|
890
911
|
let migrateConfig;
|
|
891
912
|
try {
|
|
892
913
|
migrateConfig = await this.getConfigRegexCore(repoPath, "^branch\\..*\\.gk-", { runGitLocally: true });
|
|
@@ -895,6 +916,12 @@ var ConfigGitSubProvider = class {
|
|
|
895
916
|
this._migratedRepos.add(repoPath);
|
|
896
917
|
return;
|
|
897
918
|
}
|
|
919
|
+
if (!await this.ensureGkConfigFolder(gkConfigFolder, scope)) return;
|
|
920
|
+
try {
|
|
921
|
+
await promises.writeFile(gkConfigPath, /* @__PURE__ */ new Uint8Array());
|
|
922
|
+
} catch (ex) {
|
|
923
|
+
scope?.error(ex, `Failed to create '${gkConfigPath}' file`);
|
|
924
|
+
}
|
|
898
925
|
if (!migrateConfig.size) {
|
|
899
926
|
this._migratedRepos.add(repoPath);
|
|
900
927
|
return;
|
|
@@ -948,6 +975,17 @@ __decorate([debug({ quiet: true })], ConfigGitSubProvider.prototype, "getSigning
|
|
|
948
975
|
__decorate([debug({ quiet: true })], ConfigGitSubProvider.prototype, "validateSigningSetup", null);
|
|
949
976
|
__decorate([debug()], ConfigGitSubProvider.prototype, "setSigningConfig", null);
|
|
950
977
|
__decorate([gate(), debug()], ConfigGitSubProvider.prototype, "migrateGkConfigFromGitConfig", null);
|
|
978
|
+
/**
|
|
979
|
+
* The OS account's name; `undefined` when the OS has none for the process's uid (a container run under a bare uid),
|
|
980
|
+
* where `userInfo` throws: that is no user data, not a read that failed
|
|
981
|
+
*/
|
|
982
|
+
function getOsUsername() {
|
|
983
|
+
try {
|
|
984
|
+
return userInfo().username || void 0;
|
|
985
|
+
} catch {
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
951
989
|
/** The git dir {@link ConfigGitSubProvider.getGitDir} answers from the git dirs read without git */
|
|
952
990
|
function toGitDir(fsGitDirs) {
|
|
953
991
|
const path = normalizePath(fsGitDirs.gitDir);
|
|
@@ -959,6 +997,6 @@ function toGitDir(fsGitDirs) {
|
|
|
959
997
|
};
|
|
960
998
|
}
|
|
961
999
|
//#endregion
|
|
962
|
-
export { ConfigGitSubProvider, canonicalizeGitConfigKey, gkConfigFingerprintClock, isGitBooleanFalse, isGkConfigStatRacy, mayConfigDifferByCheckout, parseConfigListing, parseConfigRegexNullOutput, parseConfigRegexOutput, parseGitBoolean };
|
|
1000
|
+
export { ConfigGitSubProvider, canonicalizeGitConfigKey, currentUserReadClock, gkConfigFingerprintClock, isGitBooleanFalse, isGkConfigStatRacy, mayConfigDifferByCheckout, parseConfigListing, parseConfigRegexNullOutput, parseConfigRegexOutput, parseGitBoolean };
|
|
963
1001
|
|
|
964
1002
|
//# sourceMappingURL=config.js.map
|