type-git 0.3.0-alpha.0 → 0.3.0-alpha.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.
- package/dist/adapters/bun/index.cjs +10 -4
- package/dist/adapters/bun/index.cjs.map +1 -1
- package/dist/adapters/bun/index.d.cts +1 -1
- package/dist/adapters/bun/index.d.ts +1 -1
- package/dist/adapters/bun/index.js +10 -4
- package/dist/adapters/bun/index.js.map +1 -1
- package/dist/adapters/deno/index.cjs +10 -4
- package/dist/adapters/deno/index.cjs.map +1 -1
- package/dist/adapters/deno/index.d.cts +1 -1
- package/dist/adapters/deno/index.d.ts +1 -1
- package/dist/adapters/deno/index.js +10 -4
- package/dist/adapters/deno/index.js.map +1 -1
- package/dist/adapters/node/index.cjs +214 -27
- package/dist/adapters/node/index.cjs.map +1 -1
- package/dist/adapters/node/index.d.cts +35 -4
- package/dist/adapters/node/index.d.ts +35 -4
- package/dist/adapters/node/index.js +214 -27
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/{adapters-BEKkCViX.d.cts → adapters-sSzx9O1u.d.cts} +121 -4
- package/dist/{adapters-BEKkCViX.d.ts → adapters-sSzx9O1u.d.ts} +121 -4
- package/dist/index.cjs +220 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +217 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
CliRunner: () => CliRunner,
|
|
34
|
+
DEFAULT_ENV_ALLOWLIST: () => DEFAULT_ENV_ALLOWLIST,
|
|
34
35
|
GIT_LOG_FORMAT: () => GIT_LOG_FORMAT,
|
|
35
36
|
GitArgumentError: () => GitArgumentError,
|
|
36
37
|
GitError: () => GitError,
|
|
@@ -55,7 +56,8 @@ __export(src_exports, {
|
|
|
55
56
|
parseLsTree: () => parseLsTree,
|
|
56
57
|
parsePorcelainV2: () => parsePorcelainV2,
|
|
57
58
|
parseRecords: () => parseRecords,
|
|
58
|
-
parseWorktreeList: () => parseWorktreeList
|
|
59
|
+
parseWorktreeList: () => parseWorktreeList,
|
|
60
|
+
resolveInheritedEnv: () => resolveInheritedEnv
|
|
59
61
|
});
|
|
60
62
|
module.exports = __toCommonJS(src_exports);
|
|
61
63
|
|
|
@@ -563,6 +565,132 @@ function detectErrorCategory(stderr) {
|
|
|
563
565
|
|
|
564
566
|
// src/runner/cli-runner.ts
|
|
565
567
|
var import_node_process = __toESM(require("process"), 1);
|
|
568
|
+
|
|
569
|
+
// src/core/env.ts
|
|
570
|
+
var DEFAULT_ENV_ALLOWLIST = [
|
|
571
|
+
// Executable resolution
|
|
572
|
+
"PATH",
|
|
573
|
+
"PATHEXT",
|
|
574
|
+
// User home / identity
|
|
575
|
+
"HOME",
|
|
576
|
+
"USER",
|
|
577
|
+
"LOGNAME",
|
|
578
|
+
// Locale and time
|
|
579
|
+
"LANG",
|
|
580
|
+
"LANGUAGE",
|
|
581
|
+
"LC_ALL",
|
|
582
|
+
"LC_CTYPE",
|
|
583
|
+
"LC_MESSAGES",
|
|
584
|
+
"LC_NUMERIC",
|
|
585
|
+
"LC_TIME",
|
|
586
|
+
"LC_COLLATE",
|
|
587
|
+
"LC_MONETARY",
|
|
588
|
+
"TZ",
|
|
589
|
+
// Temporary directories
|
|
590
|
+
"TMPDIR",
|
|
591
|
+
"TMP",
|
|
592
|
+
"TEMP",
|
|
593
|
+
// Terminal
|
|
594
|
+
"TERM",
|
|
595
|
+
"COLORTERM",
|
|
596
|
+
// SSH agent (required for Git-over-SSH authentication)
|
|
597
|
+
"SSH_AUTH_SOCK",
|
|
598
|
+
"SSH_AGENT_PID",
|
|
599
|
+
// Git SSH transport and TLS configuration. These are commonly required for
|
|
600
|
+
// fetch/push to keep working under the default allowlist. They are transport
|
|
601
|
+
// configuration rather than credential stores, but note they can still carry
|
|
602
|
+
// sensitive data depending on local setup (e.g. GIT_SSH_COMMAND can name a command
|
|
603
|
+
// Git executes). The most credential-prone / askpass variables (GIT_ASKPASS,
|
|
604
|
+
// SSH_ASKPASS, GIT_PROXY_COMMAND) are intentionally NOT inherited by default — they
|
|
605
|
+
// can carry inline credentials or run a helper that reads secrets from the
|
|
606
|
+
// environment, which would weaken the traversal-prevention model. Opt into those
|
|
607
|
+
// explicitly via `inheritEnv` when needed.
|
|
608
|
+
"GIT_SSH",
|
|
609
|
+
"GIT_SSH_COMMAND",
|
|
610
|
+
"GIT_SSH_VARIANT",
|
|
611
|
+
"GIT_SSL_CAINFO",
|
|
612
|
+
"GIT_SSL_CAPATH",
|
|
613
|
+
"GIT_TERMINAL_PROMPT",
|
|
614
|
+
"GIT_CONFIG_NOSYSTEM",
|
|
615
|
+
// HTTP(S) proxy configuration (required for Git network operations behind a proxy)
|
|
616
|
+
"HTTP_PROXY",
|
|
617
|
+
"HTTPS_PROXY",
|
|
618
|
+
"http_proxy",
|
|
619
|
+
"https_proxy",
|
|
620
|
+
"ALL_PROXY",
|
|
621
|
+
"all_proxy",
|
|
622
|
+
"NO_PROXY",
|
|
623
|
+
"no_proxy",
|
|
624
|
+
// Windows essentials
|
|
625
|
+
"USERPROFILE",
|
|
626
|
+
"HOMEDRIVE",
|
|
627
|
+
"HOMEPATH",
|
|
628
|
+
"APPDATA",
|
|
629
|
+
"LOCALAPPDATA",
|
|
630
|
+
"PROGRAMDATA",
|
|
631
|
+
"ALLUSERSPROFILE",
|
|
632
|
+
"PROGRAMFILES",
|
|
633
|
+
"PROGRAMFILES(X86)",
|
|
634
|
+
"PROGRAMW6432",
|
|
635
|
+
"PUBLIC",
|
|
636
|
+
"SYSTEMROOT",
|
|
637
|
+
"SYSTEMDRIVE",
|
|
638
|
+
"WINDIR",
|
|
639
|
+
"COMSPEC",
|
|
640
|
+
"COMPUTERNAME",
|
|
641
|
+
"USERDOMAIN",
|
|
642
|
+
"NUMBER_OF_PROCESSORS",
|
|
643
|
+
"PROCESSOR_ARCHITECTURE"
|
|
644
|
+
];
|
|
645
|
+
function pickEnv(parentEnv, predicate) {
|
|
646
|
+
const result = {};
|
|
647
|
+
for (const [key, value] of Object.entries(parentEnv)) {
|
|
648
|
+
if (value !== void 0 && predicate(key)) {
|
|
649
|
+
result[key] = value;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return result;
|
|
653
|
+
}
|
|
654
|
+
function buildAllowlist(inheritEnv) {
|
|
655
|
+
const allow = new Set(inheritEnv === false ? [] : DEFAULT_ENV_ALLOWLIST);
|
|
656
|
+
if (Array.isArray(inheritEnv)) {
|
|
657
|
+
for (const name of inheritEnv) {
|
|
658
|
+
allow.add(name);
|
|
659
|
+
}
|
|
660
|
+
return { allow, remove: void 0 };
|
|
661
|
+
}
|
|
662
|
+
if (inheritEnv === false) {
|
|
663
|
+
return { allow, remove: void 0 };
|
|
664
|
+
}
|
|
665
|
+
for (const name of inheritEnv.add ?? []) {
|
|
666
|
+
allow.add(name);
|
|
667
|
+
}
|
|
668
|
+
const hasRemove = inheritEnv.remove !== void 0 && inheritEnv.remove.length > 0;
|
|
669
|
+
const remove = hasRemove ? new Set(inheritEnv.remove) : void 0;
|
|
670
|
+
return { allow, remove };
|
|
671
|
+
}
|
|
672
|
+
function makeNameMatcher(names, isWindows) {
|
|
673
|
+
if (!isWindows) {
|
|
674
|
+
return (name) => names.has(name);
|
|
675
|
+
}
|
|
676
|
+
const lower = new Set([...names].map((name) => name.toLowerCase()));
|
|
677
|
+
return (name) => lower.has(name.toLowerCase());
|
|
678
|
+
}
|
|
679
|
+
function resolveInheritedEnv(parentEnv, inheritEnv, platform = "") {
|
|
680
|
+
if (inheritEnv === true) {
|
|
681
|
+
return pickEnv(parentEnv, () => true);
|
|
682
|
+
}
|
|
683
|
+
if (typeof inheritEnv === "function") {
|
|
684
|
+
return pickEnv(parentEnv, inheritEnv);
|
|
685
|
+
}
|
|
686
|
+
const { allow, remove } = buildAllowlist(inheritEnv ?? []);
|
|
687
|
+
const isWindows = platform === "win32";
|
|
688
|
+
const isAllowed = makeNameMatcher(allow, isWindows);
|
|
689
|
+
const isRemoved = remove ? makeNameMatcher(remove, isWindows) : () => false;
|
|
690
|
+
return pickEnv(parentEnv, (name) => isAllowed(name) && !isRemoved(name));
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// src/runner/cli-runner.ts
|
|
566
694
|
var FATAL_ERROR_PATTERN = /fatal:\s*(.+)/i;
|
|
567
695
|
var ERROR_PATTERN = /error:\s*(.+)/i;
|
|
568
696
|
var LINE_SEPARATOR_PATTERN = /\r|\n/;
|
|
@@ -616,6 +744,7 @@ var CliRunner = class _CliRunner {
|
|
|
616
744
|
exec;
|
|
617
745
|
gitBinary;
|
|
618
746
|
baseEnv;
|
|
747
|
+
inheritEnv;
|
|
619
748
|
pathPrefix;
|
|
620
749
|
home;
|
|
621
750
|
credential;
|
|
@@ -624,6 +753,7 @@ var CliRunner = class _CliRunner {
|
|
|
624
753
|
this.exec = adapters.exec;
|
|
625
754
|
this.gitBinary = options?.gitBinary ?? "git";
|
|
626
755
|
this.baseEnv = options?.env ?? {};
|
|
756
|
+
this.inheritEnv = options?.inheritEnv;
|
|
627
757
|
this.pathPrefix = options?.pathPrefix ?? [];
|
|
628
758
|
this.home = options?.home;
|
|
629
759
|
this.credential = options?.credential;
|
|
@@ -637,6 +767,7 @@ var CliRunner = class _CliRunner {
|
|
|
637
767
|
withOptions(options) {
|
|
638
768
|
const mergedEnv = { ...this.baseEnv, ...options.env };
|
|
639
769
|
const mergedPathPrefix = [...this.pathPrefix, ...options.pathPrefix ?? []];
|
|
770
|
+
const inheritEnv = options.inheritEnv ?? this.inheritEnv;
|
|
640
771
|
const home = options.home ?? this.home;
|
|
641
772
|
const credential = options.credential ?? this.credential;
|
|
642
773
|
const audit = options.audit ?? this.audit;
|
|
@@ -654,6 +785,7 @@ var CliRunner = class _CliRunner {
|
|
|
654
785
|
{
|
|
655
786
|
gitBinary: options.gitBinary ?? this.gitBinary,
|
|
656
787
|
env: mergedEnv,
|
|
788
|
+
inheritEnv,
|
|
657
789
|
pathPrefix: mergedPathPrefix,
|
|
658
790
|
home,
|
|
659
791
|
credential,
|
|
@@ -685,10 +817,16 @@ var CliRunner = class _CliRunner {
|
|
|
685
817
|
/**
|
|
686
818
|
* Build the effective environment for command execution
|
|
687
819
|
*
|
|
688
|
-
*
|
|
820
|
+
* Seeds the environment from the inherited (allowlisted) parent variables, then layers
|
|
821
|
+
* the configured `env`, home directory, and PATH prefix overrides on top. The parent
|
|
822
|
+
* process environment is never forwarded wholesale unless `inheritEnv: true` is set
|
|
823
|
+
* (environment variable traversal prevention).
|
|
689
824
|
*/
|
|
690
825
|
buildEnv() {
|
|
691
|
-
const env = {
|
|
826
|
+
const env = {
|
|
827
|
+
...resolveInheritedEnv(import_node_process.default.env, this.inheritEnv, import_node_process.default.platform),
|
|
828
|
+
...this.baseEnv
|
|
829
|
+
};
|
|
692
830
|
if (this.home) {
|
|
693
831
|
env.HOME = this.home;
|
|
694
832
|
env.USERPROFILE = this.home;
|
|
@@ -701,9 +839,11 @@ var CliRunner = class _CliRunner {
|
|
|
701
839
|
}
|
|
702
840
|
}
|
|
703
841
|
if (allPathPrefixes.length > 0) {
|
|
704
|
-
const
|
|
705
|
-
const
|
|
706
|
-
|
|
842
|
+
const isWindows = import_node_process.default.platform === "win32";
|
|
843
|
+
const separator = isWindows ? ";" : ":";
|
|
844
|
+
const pathKey = isWindows ? Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH" : "PATH";
|
|
845
|
+
const currentPath = env[pathKey] ?? "";
|
|
846
|
+
env[pathKey] = [...allPathPrefixes, currentPath].join(separator);
|
|
707
847
|
}
|
|
708
848
|
if (this.audit?.onTrace) {
|
|
709
849
|
if (env.GIT_TRACE === void 0) {
|
|
@@ -732,8 +872,11 @@ var CliRunner = class _CliRunner {
|
|
|
732
872
|
*/
|
|
733
873
|
async run(context, args, opts) {
|
|
734
874
|
const argv = this.buildArgv(context, args);
|
|
735
|
-
const { signal, onProgress, onLfsProgress } = opts ?? {};
|
|
875
|
+
const { signal, onProgress, onLfsProgress, env: envOverride } = opts ?? {};
|
|
736
876
|
const env = this.buildEnv();
|
|
877
|
+
if (envOverride) {
|
|
878
|
+
Object.assign(env, envOverride);
|
|
879
|
+
}
|
|
737
880
|
if (onLfsProgress) {
|
|
738
881
|
env.GIT_LFS_FORCE_PROGRESS = "1";
|
|
739
882
|
}
|
|
@@ -754,6 +897,9 @@ var CliRunner = class _CliRunner {
|
|
|
754
897
|
{
|
|
755
898
|
argv,
|
|
756
899
|
env,
|
|
900
|
+
// The env above is already fully resolved (including any inherited variables),
|
|
901
|
+
// so the adapter must not merge the parent environment on top of it.
|
|
902
|
+
inheritEnv: false,
|
|
757
903
|
cwd: context.type === "worktree" ? context.workdir : void 0,
|
|
758
904
|
signal
|
|
759
905
|
},
|
|
@@ -1298,7 +1444,7 @@ var BareRepoImpl = class {
|
|
|
1298
1444
|
*/
|
|
1299
1445
|
async push(opts) {
|
|
1300
1446
|
const args = ["push"];
|
|
1301
|
-
if (opts?.onProgress) {
|
|
1447
|
+
if (opts?.onProgress || opts?.onLfsProgress) {
|
|
1302
1448
|
args.push("--progress");
|
|
1303
1449
|
}
|
|
1304
1450
|
if (opts?.force) {
|
|
@@ -2196,7 +2342,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2196
2342
|
*/
|
|
2197
2343
|
async push(opts) {
|
|
2198
2344
|
const args = ["push"];
|
|
2199
|
-
if (opts?.onProgress) {
|
|
2345
|
+
if (opts?.onProgress || opts?.onLfsProgress) {
|
|
2200
2346
|
args.push("--progress");
|
|
2201
2347
|
}
|
|
2202
2348
|
if (opts?.verbose) {
|
|
@@ -2301,6 +2447,29 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2301
2447
|
setLfsMode(mode) {
|
|
2302
2448
|
this._lfsMode = mode;
|
|
2303
2449
|
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Per-command environment overrides derived from the configured LFS mode.
|
|
2452
|
+
*
|
|
2453
|
+
* When the repository was opened (or reconfigured) with an object-form LFS
|
|
2454
|
+
* mode requesting `skipSmudge` and/or `skipDownload`, working-tree-populating
|
|
2455
|
+
* operations (checkout, switch, reset, merge, pull, rebase, restore) run with
|
|
2456
|
+
* `GIT_LFS_SKIP_SMUDGE=1`. Git then leaves LFS pointer files in place instead
|
|
2457
|
+
* of downloading their contents during the implicit checkout.
|
|
2458
|
+
*
|
|
2459
|
+
* The objects can be materialized later via the explicit `repo.lfs.pull()` /
|
|
2460
|
+
* `repo.lfs.checkout()` helpers, which use dedicated git-lfs commands and are
|
|
2461
|
+
* not affected by `GIT_LFS_SKIP_SMUDGE`.
|
|
2462
|
+
*
|
|
2463
|
+
* Returns `undefined` for the `'enabled'` / `'disabled'` string modes so the
|
|
2464
|
+
* runner environment is left untouched.
|
|
2465
|
+
*/
|
|
2466
|
+
lfsModeEnv() {
|
|
2467
|
+
const mode = this._lfsMode;
|
|
2468
|
+
if (typeof mode === "object" && (mode.skipSmudge === true || mode.skipDownload === true)) {
|
|
2469
|
+
return { GIT_LFS_SKIP_SMUDGE: "1" };
|
|
2470
|
+
}
|
|
2471
|
+
return void 0;
|
|
2472
|
+
}
|
|
2304
2473
|
// ==========================================================================
|
|
2305
2474
|
// LFS Operations
|
|
2306
2475
|
// ==========================================================================
|
|
@@ -2323,7 +2492,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2323
2492
|
}
|
|
2324
2493
|
await this.runner.runOrThrow(this.context, args, {
|
|
2325
2494
|
signal: opts?.signal,
|
|
2326
|
-
onProgress: opts?.onProgress
|
|
2495
|
+
onProgress: opts?.onProgress,
|
|
2496
|
+
onLfsProgress: opts?.onLfsProgress
|
|
2327
2497
|
});
|
|
2328
2498
|
}
|
|
2329
2499
|
async lfsPush(opts) {
|
|
@@ -2352,7 +2522,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2352
2522
|
}
|
|
2353
2523
|
await this.runner.runOrThrow(this.context, args, {
|
|
2354
2524
|
signal: opts?.signal,
|
|
2355
|
-
onProgress: opts?.onProgress
|
|
2525
|
+
onProgress: opts?.onProgress,
|
|
2526
|
+
onLfsProgress: opts?.onLfsProgress
|
|
2356
2527
|
});
|
|
2357
2528
|
}
|
|
2358
2529
|
async lfsStatus(opts) {
|
|
@@ -2435,7 +2606,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2435
2606
|
const args = ["lfs", "push", remote, "--object-id", ...batch];
|
|
2436
2607
|
const result = await this.runner.run(this.context, args, {
|
|
2437
2608
|
signal: opts?.signal,
|
|
2438
|
-
onProgress: opts?.onProgress
|
|
2609
|
+
onProgress: opts?.onProgress,
|
|
2610
|
+
onLfsProgress: opts?.onLfsProgress
|
|
2439
2611
|
});
|
|
2440
2612
|
if (result.exitCode === 0) {
|
|
2441
2613
|
uploadedCount += batch.length;
|
|
@@ -2512,7 +2684,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2512
2684
|
const args = ["lfs", "fetch", remote, "--", ...batch];
|
|
2513
2685
|
const result = await this.runner.run(this.context, args, {
|
|
2514
2686
|
signal: opts?.signal,
|
|
2515
|
-
onProgress: opts?.onProgress
|
|
2687
|
+
onProgress: opts?.onProgress,
|
|
2688
|
+
onLfsProgress: opts?.onLfsProgress
|
|
2516
2689
|
});
|
|
2517
2690
|
if (result.exitCode === 0) {
|
|
2518
2691
|
downloadedCount += batch.length;
|
|
@@ -2577,7 +2750,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2577
2750
|
return;
|
|
2578
2751
|
}
|
|
2579
2752
|
const args = ["lfs", "fetch"];
|
|
2580
|
-
if (opts?.onProgress) {
|
|
2753
|
+
if (opts?.onProgress || opts?.onLfsProgress) {
|
|
2581
2754
|
args.push("--progress");
|
|
2582
2755
|
}
|
|
2583
2756
|
if (opts?.all) {
|
|
@@ -2610,7 +2783,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
2610
2783
|
}
|
|
2611
2784
|
await this.runner.runOrThrow(this.context, args, {
|
|
2612
2785
|
signal: opts?.signal,
|
|
2613
|
-
onProgress: opts?.onProgress
|
|
2786
|
+
onProgress: opts?.onProgress,
|
|
2787
|
+
onLfsProgress: opts?.onLfsProgress
|
|
2614
2788
|
});
|
|
2615
2789
|
}
|
|
2616
2790
|
async lfsInstall(opts) {
|
|
@@ -3372,7 +3546,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
3372
3546
|
}
|
|
3373
3547
|
}
|
|
3374
3548
|
await this.runner.runOrThrow(this.context, args, {
|
|
3375
|
-
signal: opts?.signal
|
|
3549
|
+
signal: opts?.signal,
|
|
3550
|
+
env: this.lfsModeEnv()
|
|
3376
3551
|
});
|
|
3377
3552
|
}
|
|
3378
3553
|
// ==========================================================================
|
|
@@ -3729,7 +3904,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
3729
3904
|
}
|
|
3730
3905
|
args.push(branch);
|
|
3731
3906
|
const result = await this.runner.run(this.context, args, {
|
|
3732
|
-
signal: opts?.signal
|
|
3907
|
+
signal: opts?.signal,
|
|
3908
|
+
env: this.lfsModeEnv()
|
|
3733
3909
|
});
|
|
3734
3910
|
if (result.exitCode !== 0) {
|
|
3735
3911
|
const statusResult = await this.runner.runOrThrow(this.context, ["status", "--porcelain"], {
|
|
@@ -3758,7 +3934,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
3758
3934
|
// ==========================================================================
|
|
3759
3935
|
async pull(opts) {
|
|
3760
3936
|
const args = ["pull"];
|
|
3761
|
-
if (opts?.onProgress) {
|
|
3937
|
+
if (opts?.onProgress || opts?.onLfsProgress) {
|
|
3762
3938
|
args.push("--progress");
|
|
3763
3939
|
}
|
|
3764
3940
|
if (opts?.rebase === true) {
|
|
@@ -3906,7 +4082,9 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
3906
4082
|
}
|
|
3907
4083
|
await this.runner.runOrThrow(this.context, args, {
|
|
3908
4084
|
signal: opts?.signal,
|
|
3909
|
-
onProgress: opts?.onProgress
|
|
4085
|
+
onProgress: opts?.onProgress,
|
|
4086
|
+
onLfsProgress: opts?.onLfsProgress,
|
|
4087
|
+
env: this.lfsModeEnv()
|
|
3910
4088
|
});
|
|
3911
4089
|
}
|
|
3912
4090
|
// ==========================================================================
|
|
@@ -3936,7 +4114,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
3936
4114
|
args.push(target);
|
|
3937
4115
|
}
|
|
3938
4116
|
await this.runner.runOrThrow(this.context, args, {
|
|
3939
|
-
signal: opts?.signal
|
|
4117
|
+
signal: opts?.signal,
|
|
4118
|
+
env: this.lfsModeEnv()
|
|
3940
4119
|
});
|
|
3941
4120
|
}
|
|
3942
4121
|
// ==========================================================================
|
|
@@ -4132,7 +4311,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
4132
4311
|
args.push(opts.startPoint);
|
|
4133
4312
|
}
|
|
4134
4313
|
await this.runner.runOrThrow(this.context, args, {
|
|
4135
|
-
signal: opts?.signal
|
|
4314
|
+
signal: opts?.signal,
|
|
4315
|
+
env: this.lfsModeEnv()
|
|
4136
4316
|
});
|
|
4137
4317
|
}
|
|
4138
4318
|
// ==========================================================================
|
|
@@ -4559,7 +4739,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
4559
4739
|
args.push(opts.upstream);
|
|
4560
4740
|
}
|
|
4561
4741
|
await this.runner.runOrThrow(this.context, args, {
|
|
4562
|
-
signal: opts?.signal
|
|
4742
|
+
signal: opts?.signal,
|
|
4743
|
+
env: this.lfsModeEnv()
|
|
4563
4744
|
});
|
|
4564
4745
|
}
|
|
4565
4746
|
// ==========================================================================
|
|
@@ -4617,7 +4798,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
|
|
|
4617
4798
|
const pathList = Array.isArray(paths) ? paths : [paths];
|
|
4618
4799
|
args.push("--", ...pathList);
|
|
4619
4800
|
await this.runner.runOrThrow(this.context, args, {
|
|
4620
|
-
signal: opts?.signal
|
|
4801
|
+
signal: opts?.signal,
|
|
4802
|
+
env: this.lfsModeEnv()
|
|
4621
4803
|
});
|
|
4622
4804
|
}
|
|
4623
4805
|
// ==========================================================================
|
|
@@ -5528,6 +5710,7 @@ function toCliRunnerOptions(opts) {
|
|
|
5528
5710
|
}
|
|
5529
5711
|
return {
|
|
5530
5712
|
env: opts.env,
|
|
5713
|
+
inheritEnv: opts.inheritEnv,
|
|
5531
5714
|
pathPrefix: opts.pathPrefix,
|
|
5532
5715
|
home: opts.home,
|
|
5533
5716
|
credential: opts.credential ? {
|
|
@@ -5629,7 +5812,7 @@ var GitImpl = class {
|
|
|
5629
5812
|
}
|
|
5630
5813
|
async clone(url, path, opts) {
|
|
5631
5814
|
const args = buildCloneArgs(opts);
|
|
5632
|
-
if (opts?.onProgress) {
|
|
5815
|
+
if (opts?.onProgress || opts?.onLfsProgress) {
|
|
5633
5816
|
args.push("--progress");
|
|
5634
5817
|
}
|
|
5635
5818
|
args.push(url, path);
|
|
@@ -5971,6 +6154,12 @@ async function createGit(options) {
|
|
|
5971
6154
|
|
|
5972
6155
|
// src/adapters/node/exec.ts
|
|
5973
6156
|
var import_node_child_process = require("child_process");
|
|
6157
|
+
function resolveChildEnv(env, inheritEnv) {
|
|
6158
|
+
if (inheritEnv === false) {
|
|
6159
|
+
return env ?? {};
|
|
6160
|
+
}
|
|
6161
|
+
return env ? { ...process.env, ...env } : process.env;
|
|
6162
|
+
}
|
|
5974
6163
|
async function* streamToAsyncIterable(stream) {
|
|
5975
6164
|
let buffer = "";
|
|
5976
6165
|
for await (const chunk of stream) {
|
|
@@ -5997,7 +6186,7 @@ var NodeExecAdapter = class {
|
|
|
5997
6186
|
};
|
|
5998
6187
|
}
|
|
5999
6188
|
spawn(options, handlers) {
|
|
6000
|
-
const { argv, env, cwd, signal } = options;
|
|
6189
|
+
const { argv, env, inheritEnv, cwd, signal } = options;
|
|
6001
6190
|
const command = argv[0];
|
|
6002
6191
|
if (command === void 0) {
|
|
6003
6192
|
throw new Error("argv must not be empty");
|
|
@@ -6006,7 +6195,7 @@ var NodeExecAdapter = class {
|
|
|
6006
6195
|
return new Promise((resolve, reject) => {
|
|
6007
6196
|
const child = (0, import_node_child_process.spawn)(command, args, {
|
|
6008
6197
|
cwd,
|
|
6009
|
-
env: env
|
|
6198
|
+
env: resolveChildEnv(env, inheritEnv),
|
|
6010
6199
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6011
6200
|
});
|
|
6012
6201
|
let stdout = "";
|
|
@@ -6054,7 +6243,7 @@ var NodeExecAdapter = class {
|
|
|
6054
6243
|
});
|
|
6055
6244
|
}
|
|
6056
6245
|
spawnStreaming(options) {
|
|
6057
|
-
const { argv, env, cwd, signal } = options;
|
|
6246
|
+
const { argv, env, inheritEnv, cwd, signal } = options;
|
|
6058
6247
|
const command = argv[0];
|
|
6059
6248
|
if (command === void 0) {
|
|
6060
6249
|
throw new Error("argv must not be empty");
|
|
@@ -6062,7 +6251,7 @@ var NodeExecAdapter = class {
|
|
|
6062
6251
|
const args = argv.slice(1);
|
|
6063
6252
|
const child = (0, import_node_child_process.spawn)(command, args, {
|
|
6064
6253
|
cwd,
|
|
6065
|
-
env: env
|
|
6254
|
+
env: resolveChildEnv(env, inheritEnv),
|
|
6066
6255
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6067
6256
|
});
|
|
6068
6257
|
let aborted = false;
|
|
@@ -6460,6 +6649,7 @@ var TypeGit = class _TypeGit {
|
|
|
6460
6649
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6461
6650
|
0 && (module.exports = {
|
|
6462
6651
|
CliRunner,
|
|
6652
|
+
DEFAULT_ENV_ALLOWLIST,
|
|
6463
6653
|
GIT_LOG_FORMAT,
|
|
6464
6654
|
GitArgumentError,
|
|
6465
6655
|
GitError,
|
|
@@ -6484,6 +6674,7 @@ var TypeGit = class _TypeGit {
|
|
|
6484
6674
|
parseLsTree,
|
|
6485
6675
|
parsePorcelainV2,
|
|
6486
6676
|
parseRecords,
|
|
6487
|
-
parseWorktreeList
|
|
6677
|
+
parseWorktreeList,
|
|
6678
|
+
resolveInheritedEnv
|
|
6488
6679
|
});
|
|
6489
6680
|
//# sourceMappingURL=index.cjs.map
|