@gitkraken/core-gitlens 0.12.0 → 0.14.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 +78 -1
- package/dist/git/cache.d.ts +84 -29
- package/dist/git/cache.js +188 -54
- package/dist/git/cache.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +5 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/branch.d.ts +20 -2
- package/dist/git/models/branch.js +28 -6
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/reference.d.ts +3 -0
- package/dist/git/models/status.js +2 -2
- package/dist/git/models/worktree.d.ts +4 -1
- package/dist/git/models/worktree.js +4 -2
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/parsers/diffParser.js +1 -1
- package/dist/git/providers/branches.d.ts +73 -8
- package/dist/git/providers/operations.d.ts +3 -2
- package/dist/git/providers/pausedOperations.d.ts +6 -0
- package/dist/git/providers/provider.d.ts +45 -2
- package/dist/git/providers/revision.d.ts +17 -3
- package/dist/git/providers/status.d.ts +8 -2
- package/dist/git/remotes/azure-devops.js +61 -53
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/run.types.d.ts +12 -0
- package/dist/git/service.d.ts +8 -5
- package/dist/git/service.js +16 -8
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/branch.utils.d.ts +12 -2
- package/dist/git/utils/branch.utils.js +49 -5
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/reference.utils.d.ts +1 -0
- package/dist/git/utils/reference.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +13 -2
- package/dist/git/watching/changeEvent.js +17 -3
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/gitDirPoller.d.ts +111 -0
- package/dist/git/watching/gitDirPoller.js +266 -0
- package/dist/git/watching/gitDirPoller.js.map +1 -0
- package/dist/git/watching/provider.d.ts +16 -0
- package/dist/git/watching/watchGroup.d.ts +40 -4
- package/dist/git/watching/watchGroup.js +143 -17
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +70 -1
- package/dist/git/watching/watchService.js +158 -13
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +44 -0
- package/dist/git/watching/watchSession.js +91 -6
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +21 -0
- package/dist/git/watching/watcherPatterns.js +67 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +34 -7
- package/dist/git/watching/worktreeSummary.js +39 -12
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +40 -2
- package/dist/git-cli/cliGitProvider.js +182 -18
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +15 -0
- package/dist/git-cli/exec/commandClassifier.js +48 -2
- package/dist/git-cli/exec/commandClassifier.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +20 -3
- package/dist/git-cli/exec/git.js +63 -19
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +2 -0
- package/dist/git-cli/exec/gitQueue.js +2 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +39 -0
- package/dist/git-cli/exec/indexLock.js +160 -0
- package/dist/git-cli/exec/indexLock.js.map +1 -0
- package/dist/git-cli/parsers/blameParser.js +2 -2
- package/dist/git-cli/parsers/refParser.js +4 -2
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/parsers/statusParser.d.ts +6 -0
- package/dist/git-cli/parsers/statusParser.js +33 -3
- package/dist/git-cli/parsers/statusParser.js.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.js +42 -2
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/branchRemote.d.ts +14 -0
- package/dist/git-cli/providers/branchRemote.js +36 -0
- package/dist/git-cli/providers/branchRemote.js.map +1 -0
- package/dist/git-cli/providers/branches.d.ts +109 -10
- package/dist/git-cli/providers/branches.js +630 -134
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.js +2 -2
- package/dist/git-cli/providers/config.d.ts +9 -5
- package/dist/git-cli/providers/config.js +58 -25
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.js +1 -1
- package/dist/git-cli/providers/graph.js +9 -6
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +17 -0
- package/dist/git-cli/providers/operations.js +172 -111
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +8 -0
- package/dist/git-cli/providers/pausedOperations.js +59 -39
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.js +11 -8
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +19 -10
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +6 -2
- package/dist/git-cli/providers/revision.js +38 -12
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.js +39 -14
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +2 -0
- package/dist/git-cli/providers/stash.js +33 -18
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +3 -1
- package/dist/git-cli/providers/status.js +40 -22
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.js +6 -4
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +1 -0
- package/dist/git-cli/providers/worktrees.js +60 -31
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts +6 -0
- package/dist/git-cli/service.js +5 -2
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts +6 -2
- package/dist/plus/git-github/providers/github/revision.js +15 -10
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +3 -1
- package/dist/plus/git-github/providers/github/status.js +2 -2
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +13 -2
- package/dist/plus/integrations/collectionMetadata.js +14 -2
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -0
- package/dist/plus/integrations/integrationService.js +1 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -5
- package/dist/plus/integrations/models/gitHostIntegration.js +106 -29
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/issueReads.d.ts +17 -4
- package/dist/plus/integrations/providers/apiClients.d.ts +2 -0
- package/dist/plus/integrations/providers/apiClients.js +7 -1
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +5 -4
- package/dist/plus/integrations/providers/azure/azure.js +36 -76
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js +20 -17
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +2 -2
- package/dist/plus/integrations/providers/azure/models.js +4 -4
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azure/workItemStateCategories.d.ts +21 -12
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js +74 -17
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +44 -0
- package/dist/plus/integrations/providers/azureDevOps.js +108 -17
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +45 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +121 -6
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/jira-server.js +18 -14
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.js +18 -14
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +1 -2
- package/dist/plus/integrations/providers/models.js +9 -2
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -17
- package/dist/plus/integrations/providers/providersApi.js +85 -78
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +22 -0
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +69 -9
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js +8 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -3
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -1
- package/dist/plus/integrations/reads/issueBatch.js +1 -1
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +23 -14
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +2 -1
- package/dist/plus/integrations/reads/issues.js +18 -3
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +12 -3
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +11 -4
- package/dist/plus/integrations/reads/warnings.js +15 -5
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +36 -2
- package/dist/plus/integrations/results.js +33 -13
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +10 -0
- package/dist/utils/promiseCache.js +17 -2
- package/dist/utils/promiseCache.js.map +1 -1
- package/docs/integrations.md +52 -20
- package/package.json +2 -2
package/dist/git-cli/exec/git.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { chunkByStringLength } from "../../utils/iterable.js";
|
|
1
2
|
import { getScopedCounter } from "../../utils/counter.js";
|
|
2
3
|
import { CancellationError, getAbortSignalId, isCancellationError } from "../../utils/cancellation.js";
|
|
3
4
|
import { getDurationMilliseconds, hrtime } from "../../utils/hrtime.js";
|
|
@@ -7,11 +8,12 @@ import { defer } from "../../utils/promise.js";
|
|
|
7
8
|
import { arePathsEqual, dirname as dirname$1, isAbsolute as isAbsolute$1, isDescendant, joinPaths, normalizePath } from "../../utils/path.js";
|
|
8
9
|
import { GitWarnings, WorkspaceUntrustedError, getGitWarning } from "../../git/errors.js";
|
|
9
10
|
import { gitFeaturesByVersion } from "../../git/features.js";
|
|
11
|
+
import { getChangesForCommand, leadingCommand } from "./commandClassifier.js";
|
|
10
12
|
import { CancelledRunError, RunError, endStdin, fsExists, runSpawn } from "../../utils/env/node/exec.js";
|
|
11
13
|
import { compare, fromString } from "../../utils/version.js";
|
|
12
|
-
import { getChangesForCommand, leadingCommand } from "./commandClassifier.js";
|
|
13
14
|
import { EventLoopMonitor } from "./eventLoopMonitor.js";
|
|
14
15
|
import { GitQueue, getPrimaryGitCommand, inferGitCommandPriority } from "./gitQueue.js";
|
|
16
|
+
import { KeyedSequencer, isConfigCommand, isIndexWriteCommand, retryWhileConfigLocked, retryWhileIndexLocked } from "./indexLock.js";
|
|
15
17
|
import { resolve } from "path";
|
|
16
18
|
import { spawn } from "child_process";
|
|
17
19
|
import * as process from "process";
|
|
@@ -22,6 +24,15 @@ const queueWaitAnnotationThreshold = 100;
|
|
|
22
24
|
/** Below this, a measured event-loop stall isn't worth annotating — see {@link EventLoopMonitor}. */
|
|
23
25
|
const eventLoopDelayAnnotationThreshold = 500;
|
|
24
26
|
const maxGitCliLength = 3e4;
|
|
27
|
+
/**
|
|
28
|
+
* Splits `paths` into `:(literal)` pathspec batches that each fit the command-line length limit after `prefix`, so a
|
|
29
|
+
* folder named like a glob (`[id]/`) doesn't match its siblings.
|
|
30
|
+
*/
|
|
31
|
+
function batchLiteralPathspecs(paths, prefix) {
|
|
32
|
+
const perArgOverhead = 3;
|
|
33
|
+
const prefixLength = [...prefix, "--"].reduce((sum, arg) => sum + arg.length + perArgOverhead, 0);
|
|
34
|
+
return chunkByStringLength(paths.map((p) => `:(literal)${p}`), maxGitCliLength - prefixLength, perArgOverhead);
|
|
35
|
+
}
|
|
25
36
|
const gitConfigsBranch = ["-c", "color.branch=false"];
|
|
26
37
|
const gitConfigsDiff = [
|
|
27
38
|
"-c",
|
|
@@ -418,6 +429,10 @@ var Git = class {
|
|
|
418
429
|
pendingCommands = /* @__PURE__ */ new Map();
|
|
419
430
|
/** Queue for throttling background git operations */
|
|
420
431
|
_queue;
|
|
432
|
+
/** Orders the index-writing runs of each checkout, so they don't race for its `index.lock` */
|
|
433
|
+
_indexWrites = new KeyedSequencer();
|
|
434
|
+
/** The spawn behind every non-streaming run — a field only so tests can substitute it */
|
|
435
|
+
_runSpawn = runSpawn;
|
|
421
436
|
/** Detects event-loop stalls while at least one git command is in flight */
|
|
422
437
|
_eventLoopMonitor = new EventLoopMonitor();
|
|
423
438
|
/** Count of git commands currently in flight, across both the exec and streaming paths */
|
|
@@ -440,7 +455,9 @@ var Git = class {
|
|
|
440
455
|
* to its own `notifyChanged` from its constructor — including when it's handed a pre-built `Git` via
|
|
441
456
|
* `options.git`, so a host-supplied instance gets bound too. With nothing bound, `notify` is a no-op.
|
|
442
457
|
* `repoPaths` holds more than one path only for a `-C`-scoped shared-state verb: the `-C` target, then the
|
|
443
|
-
* caller's own `cwd`.
|
|
458
|
+
* caller's own `cwd`. `sharedPaths` names the paths that were not run in but share the repository, which
|
|
459
|
+
* hear only the part of `changes` every worktree sees (the caller's `cwd`, when the verb also changed
|
|
460
|
+
* something local to the `-C` target).
|
|
444
461
|
*/
|
|
445
462
|
bindChangeNotifier(fn) {
|
|
446
463
|
this._changeNotifier = fn;
|
|
@@ -601,10 +618,7 @@ var Git = class {
|
|
|
601
618
|
const cwd = normalizePath(options.cwd);
|
|
602
619
|
if (command.pathOverride != null && cwd !== ranIn && (command.sharedChanges.length || !command.changes.length)) {
|
|
603
620
|
if (command.sharedChanges.length === command.changes.length) this._changeNotifier([ranIn, cwd], command.changes);
|
|
604
|
-
else
|
|
605
|
-
this._changeNotifier([ranIn], command.changes);
|
|
606
|
-
this._changeNotifier([cwd], command.sharedChanges);
|
|
607
|
-
}
|
|
621
|
+
else this._changeNotifier([ranIn], command.changes, [cwd]);
|
|
608
622
|
return;
|
|
609
623
|
}
|
|
610
624
|
this._changeNotifier([ranIn], command.changes);
|
|
@@ -616,19 +630,20 @@ var Git = class {
|
|
|
616
630
|
const start = hrtime();
|
|
617
631
|
const startEpochMs = Date.now();
|
|
618
632
|
gitCommand = `[${options.cwd}] ${gitCommand}`;
|
|
619
|
-
const { cancellation, configs, correlationKey, errors: errorHandling, encoding, expectedExitCodes, runLocally: _, selfMaintenance, slownessCategory, ...opts } = options;
|
|
620
|
-
const
|
|
633
|
+
const { beforeIndexLockRetry, cancellation, configs, correlationKey, errors: errorHandling, encoding, expectedExitCodes, runLocally: _, selfMaintenance, slownessCategory, ...opts } = options;
|
|
634
|
+
const runTimeout = opts.timeout ?? this.options.gitTimeout ?? 6e4;
|
|
621
635
|
const runOpts = {
|
|
622
636
|
...opts,
|
|
623
|
-
timeout:
|
|
637
|
+
timeout: runTimeout === 0 ? void 0 : runTimeout,
|
|
624
638
|
encoding: (encoding ?? "utf8") === "utf8" ? "utf8" : "buffer",
|
|
625
639
|
decode: this.options.decode,
|
|
626
640
|
env: this.buildEnv(options.env),
|
|
627
641
|
quiet: errorHandling === "ignore"
|
|
628
642
|
};
|
|
629
|
-
const unshared = options?.stdin != null || options?.env != null && Object.keys(options.env).length > 0;
|
|
643
|
+
const unshared = options?.stdin != null || options?.env != null && Object.keys(options.env).length > 0 || beforeIndexLockRetry != null;
|
|
630
644
|
const cacheKey = `${correlationKey !== void 0 ? `${correlationKey}:` : ""}${unshared ? `${unsharedRunCounter.next()}:` : ""}${cancellation != null ? `${getAbortSignalId(cancellation)}:` : ""}${gitCommand}`;
|
|
631
645
|
let execStart;
|
|
646
|
+
let hookFailure;
|
|
632
647
|
let waiting;
|
|
633
648
|
let promise = this.pendingCommands.get(cacheKey)?.promise;
|
|
634
649
|
if (promise == null) {
|
|
@@ -639,15 +654,27 @@ var Git = class {
|
|
|
639
654
|
cwd: options.cwd,
|
|
640
655
|
promise
|
|
641
656
|
});
|
|
657
|
+
const writesIndex = isIndexWriteCommand(args);
|
|
658
|
+
const checkoutKey = writesIndex && options.cwd != null && runOpts.env?.GIT_INDEX_FILE == null ? this.resolveNotifyPath(options.cwd, leadingCommand(args).pathOverride) : void 0;
|
|
642
659
|
args.unshift("-c", "core.quotepath=false", "-c", "color.ui=false", ...configs ?? emptyArray);
|
|
643
660
|
if (process.platform === "win32") args.unshift("-c", "core.longpaths=true");
|
|
644
661
|
if (cancellation != null) runOpts.cancellation = cancellation;
|
|
645
662
|
const priority = options.priority ?? inferGitCommandPriority(args);
|
|
646
663
|
const gitPath = await this.path();
|
|
647
|
-
this._queue.run(priority, () => {
|
|
664
|
+
const spawnQueued = () => this._queue.run(priority, () => {
|
|
648
665
|
execStart = hrtime();
|
|
649
|
-
return
|
|
650
|
-
}, cancellation)
|
|
666
|
+
return this._runSpawn(gitPath, args, encoding ?? "utf8", runOpts);
|
|
667
|
+
}, cancellation);
|
|
668
|
+
const beforeRetry = beforeIndexLockRetry != null ? async (lockError) => {
|
|
669
|
+
try {
|
|
670
|
+
await beforeIndexLockRetry(lockError);
|
|
671
|
+
} catch (ex) {
|
|
672
|
+
if (ex !== lockError) hookFailure = { error: ex };
|
|
673
|
+
throw ex;
|
|
674
|
+
}
|
|
675
|
+
} : void 0;
|
|
676
|
+
const spawnWithRetry = writesIndex ? () => retryWhileIndexLocked(spawnQueued, cancellation, beforeRetry) : isConfigCommand(args) ? () => retryWhileConfigLocked(spawnQueued, cancellation) : spawnQueued;
|
|
677
|
+
(checkoutKey != null ? this._indexWrites.run(checkoutKey, cancellation, spawnWithRetry) : spawnWithRetry()).then(deferred.fulfill, (e) => deferred.cancel(e instanceof Error ? e : new Error(String(e)))).finally(() => {
|
|
651
678
|
if (this.pendingCommands.get(cacheKey)?.promise === deferred.promise) this.pendingCommands.delete(cacheKey);
|
|
652
679
|
}).catch(() => {});
|
|
653
680
|
} else {
|
|
@@ -681,6 +708,10 @@ var Git = class {
|
|
|
681
708
|
}
|
|
682
709
|
};
|
|
683
710
|
} catch (ex) {
|
|
711
|
+
if (hookFailure != null) {
|
|
712
|
+
exception = hookFailure.error instanceof Error ? hookFailure.error : new Error(String(hookFailure.error));
|
|
713
|
+
throw hookFailure.error;
|
|
714
|
+
}
|
|
684
715
|
if (expectedExitCodes?.length && ex instanceof RunError && !(ex instanceof CancelledRunError)) {
|
|
685
716
|
const code = toExitCode(ex.code);
|
|
686
717
|
if (code != null && expectedExitCodes.includes(code)) return {
|
|
@@ -858,11 +889,24 @@ var Git = class {
|
|
|
858
889
|
}
|
|
859
890
|
return void cleanup();
|
|
860
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* Resolves the git dir (and common dir, for a linked worktree) of `cwd`.
|
|
894
|
+
*
|
|
895
|
+
* Resolves `undefined` when `cwd` is not in a repository: git reported so, or `cwd` doesn't exist. Any
|
|
896
|
+
* other failure (unsafe ownership, a timeout or cancellation, a missing git binary) rejects.
|
|
897
|
+
*/
|
|
861
898
|
async rev_parse__git_dir(cwd) {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
899
|
+
let result;
|
|
900
|
+
try {
|
|
901
|
+
result = await this.run({
|
|
902
|
+
cwd,
|
|
903
|
+
errors: "throw"
|
|
904
|
+
}, "rev-parse", "--git-dir", "--git-common-dir");
|
|
905
|
+
} catch (ex) {
|
|
906
|
+
if (ex instanceof GitError && GitWarnings.notARepository.test(ex.stderr ?? "")) return void 0;
|
|
907
|
+
if (!await fsExists(cwd)) return void 0;
|
|
908
|
+
throw ex;
|
|
909
|
+
}
|
|
866
910
|
if (!result.stdout) return void 0;
|
|
867
911
|
let [dotGitPath, commonDotGitPath] = result.stdout.split("\n").map((r) => r.trimStart());
|
|
868
912
|
if (!isAbsolute$1(dotGitPath)) dotGitPath = joinPaths(cwd, dotGitPath);
|
|
@@ -913,7 +957,7 @@ var Git = class {
|
|
|
913
957
|
errors: "ignore"
|
|
914
958
|
}, "rev-parse", "--is-bare-repository");
|
|
915
959
|
if (result.stdout.trim() === "true") {
|
|
916
|
-
const result = await this.rev_parse__git_dir(cwd);
|
|
960
|
+
const result = await this.rev_parse__git_dir(cwd).catch(() => void 0);
|
|
917
961
|
const repoPath = result?.commonPath ?? result?.path;
|
|
918
962
|
if (repoPath?.length) return [true, repoPath];
|
|
919
963
|
}
|
|
@@ -1003,6 +1047,6 @@ function defaultExceptionHandler(ex, cwd, start) {
|
|
|
1003
1047
|
throw ex;
|
|
1004
1048
|
}
|
|
1005
1049
|
//#endregion
|
|
1006
|
-
export { Git, GitError, GitErrors, GitWarnings, classifySearchError, classifySigningError, defaultExceptionHandler, getGitCommandError, gitConfigsBranch, gitConfigsDiff, gitConfigsLog, gitConfigsLogWithFiles, gitConfigsLogWithSignatures, gitConfigsPull, gitConfigsStatus, inferSigningFormatFromError, maxGitCliLength, slowCallWarningThreshold };
|
|
1050
|
+
export { Git, GitError, GitErrors, GitWarnings, batchLiteralPathspecs, classifySearchError, classifySigningError, defaultExceptionHandler, getGitCommandError, gitConfigsBranch, gitConfigsDiff, gitConfigsLog, gitConfigsLogWithFiles, gitConfigsLogWithSignatures, gitConfigsPull, gitConfigsStatus, inferSigningFormatFromError, maxGitCliLength, slowCallWarningThreshold };
|
|
1007
1051
|
|
|
1008
1052
|
//# sourceMappingURL=git.js.map
|