type-git 0.8.1 → 0.8.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.
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunk6HDMSFY7cjs = require('./chunk-6HDMSFY7.cjs');
22
+ var _chunkRWKMVYO5cjs = require('./chunk-RWKMVYO5.cjs');
23
23
 
24
24
  // src/core/clone-config.ts
25
25
  var HTTP_VARIABLES = [
@@ -108,15 +108,15 @@ function cloneConfigArgs(config) {
108
108
  continue;
109
109
  }
110
110
  if (!isCloneConfigKey(key)) {
111
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
111
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
112
112
  `clone: config key ${JSON.stringify(key)} is not accepted; clone only takes data-only keys (see CloneConfigSchema). Set other keys with repo.config after cloning, or use raw() or strict command() if the value is trusted.`
113
113
  );
114
114
  }
115
115
  if (typeof value !== "string") {
116
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(`clone: config value for ${JSON.stringify(key)} must be a string`);
116
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(`clone: config value for ${JSON.stringify(key)} must be a string`);
117
117
  }
118
118
  if (hasLineBreak(value)) {
119
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
119
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
120
120
  `clone: config value for ${JSON.stringify(key)} must not contain NUL, CR or LF`
121
121
  );
122
122
  }
@@ -131,7 +131,7 @@ function isOptionLike(value) {
131
131
  }
132
132
  function checkedOperand(command, name, value) {
133
133
  if (isOptionLike(value)) {
134
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
134
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
135
135
  `${command}: ${name} must not start with '-' (got ${JSON.stringify(value)}); Git would parse it as an option.`
136
136
  );
137
137
  }
@@ -144,21 +144,37 @@ function checkedOperands(command, name, values) {
144
144
  return [...values];
145
145
  }
146
146
  function checkedNewBranchName(command, name, value) {
147
- if (_chunk6HDMSFY7cjs.branchNameSyntax.call(void 0, value) === false) {
148
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
147
+ if (_chunkRWKMVYO5cjs.branchNameSyntax.call(void 0, value) === false) {
148
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
149
149
  `${command}: ${name} is not a valid branch name (got ${JSON.stringify(value)}); see git check-ref-format --branch.`
150
150
  );
151
151
  }
152
152
  return value;
153
153
  }
154
154
  function checkedRefSortKey(command, value) {
155
- if (!_chunk6HDMSFY7cjs.validRefSortKey.call(void 0, value)) {
156
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
155
+ if (!_chunkRWKMVYO5cjs.validRefSortKey.call(void 0, value)) {
156
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
157
157
  `${command}: sort is not a ref-filter sort key (got ${JSON.stringify(value)}); use an optional '-', an optional version: or v:, and a field name such as refname.`
158
158
  );
159
159
  }
160
160
  return value;
161
161
  }
162
+ function checkedRevision(command, name, value) {
163
+ if (value === "") {
164
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
165
+ `${command}: ${name} must not be empty; Git rejects an empty revision.`
166
+ );
167
+ }
168
+ return checkedOperand(command, name, value);
169
+ }
170
+ function checkedOptionValue(command, name, value) {
171
+ if (value === "") {
172
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
173
+ `${command}: ${name} must not be empty; Git rejects an empty value here.`
174
+ );
175
+ }
176
+ return value;
177
+ }
162
178
 
163
179
  // src/core/untrusted-repo.ts
164
180
  var UNTRUSTED_REPO_MIN_GIT_VERSION = "2.38.0";
@@ -397,12 +413,12 @@ function configValue(key, value, implicit = false) {
397
413
  }
398
414
  }
399
415
  if (!allowed.includes(normalized)) {
400
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", `Invalid value for ${key}: expected ${allowed.join(" | ")}`);
416
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", `Invalid value for ${key}: expected ${allowed.join(" | ")}`);
401
417
  }
402
418
  return normalized;
403
419
  }
404
420
  async function readConfig(runner, context, key, opts) {
405
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "configGet", opts);
421
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "configGet", opts);
406
422
  const args = ["config", ...context.type === "global" ? ["--global"] : [], "--null"];
407
423
  if (_optionalChain([opts, 'optionalAccess', _17 => _17.type])) {
408
424
  args.push(`--type=${opts.type}`);
@@ -416,11 +432,11 @@ async function readConfig(runner, context, key, opts) {
416
432
  return _optionalChain([opts, 'optionalAccess', _20 => _20.all]) ? [] : void 0;
417
433
  }
418
434
  runner.checkResult(context, args, result);
419
- const values = _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
435
+ const values = _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
420
436
  return _optionalChain([opts, 'optionalAccess', _21 => _21.all]) ? values : values[0];
421
437
  }
422
438
  async function listConfig(runner, context, opts) {
423
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "configList", opts);
439
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "configList", opts);
424
440
  const args = ["config", ...context.type === "global" ? ["--global"] : [], "--null", "--list"];
425
441
  if (_optionalChain([opts, 'optionalAccess', _22 => _22.showOrigin])) {
426
442
  args.push("--show-origin");
@@ -432,14 +448,14 @@ async function listConfig(runner, context, opts) {
432
448
  args.push(opts.includes ? "--includes" : "--no-includes");
433
449
  }
434
450
  const result = await runner.runOrThrow(context, args, opts);
435
- const records = _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
451
+ const records = _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
436
452
  const entries = [];
437
453
  for (let i = 0; i < records.length; ) {
438
454
  const scope = _optionalChain([opts, 'optionalAccess', _25 => _25.showScope]) ? records[i++] : void 0;
439
455
  const origin = _optionalChain([opts, 'optionalAccess', _26 => _26.showOrigin]) ? records[i++] : void 0;
440
456
  const entry = records[i++];
441
457
  if (entry === void 0) {
442
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Incomplete config record");
458
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Incomplete config record");
443
459
  }
444
460
  const separator = entry.indexOf("\n");
445
461
  entries.push({
@@ -465,7 +481,7 @@ async function readTypedConfig(runner, context, key, opts, all = false) {
465
481
  return [];
466
482
  }
467
483
  runner.checkResult(context, args, result);
468
- const records = _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
484
+ const records = _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
469
485
  return (all ? records : records.slice(-1)).map((record2) => {
470
486
  const separator = record2.indexOf("\n");
471
487
  return configValue(key, separator < 0 ? "" : record2.slice(separator + 1), separator < 0);
@@ -598,7 +614,7 @@ async function fetch(runner, context, opts) {
598
614
  });
599
615
  }
600
616
  async function push(runner, context, opts) {
601
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "push", opts);
617
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "push", opts);
602
618
  const args = ["push"];
603
619
  if (_optionalChain([opts, 'optionalAccess', _64 => _64.onProgress]) || _optionalChain([opts, 'optionalAccess', _65 => _65.onLfsProgress])) {
604
620
  args.push("--progress");
@@ -901,7 +917,7 @@ var BareRepoImpl = (_class = class {
901
917
  constructor(runner, gitDir, _options) {;_class.prototype.__init.call(this);
902
918
  this.runner = runner;
903
919
  this.gitDir = gitDir;
904
- _chunk6HDMSFY7cjs.registerCommandHost.call(void 0, this, () => ({
920
+ _chunkRWKMVYO5cjs.registerCommandHost.call(void 0, this, () => ({
905
921
  runner: this.runner,
906
922
  context: this.context,
907
923
  inRepository: true
@@ -962,7 +978,7 @@ var BareRepoImpl = (_class = class {
962
978
  * List references in a remote repository
963
979
  */
964
980
  async lsRemote(remote, opts) {
965
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lsRemote", opts);
981
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lsRemote", opts);
966
982
  const args = ["ls-remote"];
967
983
  if (_optionalChain([opts, 'optionalAccess', _94 => _94.heads])) {
968
984
  args.push("--heads");
@@ -973,8 +989,8 @@ var BareRepoImpl = (_class = class {
973
989
  if (_optionalChain([opts, 'optionalAccess', _96 => _96.refsOnly])) {
974
990
  args.push("--refs");
975
991
  }
976
- if (_optionalChain([opts, 'optionalAccess', _97 => _97.sort])) {
977
- args.push("--sort", opts.sort);
992
+ if (_optionalChain([opts, 'optionalAccess', _97 => _97.sort]) !== void 0) {
993
+ args.push("--sort", checkedOptionValue("lsRemote", "sort", opts.sort));
978
994
  }
979
995
  args.push(checkedOperand("lsRemote", "remote", remote));
980
996
  if (_optionalChain([opts, 'optionalAccess', _98 => _98.refs]) && opts.refs.length > 0) {
@@ -984,11 +1000,11 @@ var BareRepoImpl = (_class = class {
984
1000
  signal: _optionalChain([opts, 'optionalAccess', _99 => _99.signal]),
985
1001
  onProgress: _optionalChain([opts, 'optionalAccess', _100 => _100.onProgress])
986
1002
  });
987
- const refs = _chunk6HDMSFY7cjs.parseLsRemote.call(void 0, result.stdout);
1003
+ const refs = _chunkRWKMVYO5cjs.parseLsRemote.call(void 0, result.stdout);
988
1004
  return { refs };
989
1005
  }
990
1006
  async lsTree(treeish, opts) {
991
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lsTree", opts);
1007
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lsTree", opts);
992
1008
  const args = ["ls-tree", "-z"];
993
1009
  if (_optionalChain([opts, 'optionalAccess', _101 => _101.recursive])) {
994
1010
  args.push("-r");
@@ -1022,7 +1038,7 @@ var BareRepoImpl = (_class = class {
1022
1038
  const result = await this.runner.runOrThrow(this.context, args, {
1023
1039
  signal: _optionalChain([opts, 'optionalAccess', _109 => _109.signal])
1024
1040
  });
1025
- const entries = _chunk6HDMSFY7cjs.parseLsTree.call(void 0, result.stdout, { long: _optionalChain([opts, 'optionalAccess', _110 => _110.long]) });
1041
+ const entries = _chunkRWKMVYO5cjs.parseLsTree.call(void 0, result.stdout, { long: _optionalChain([opts, 'optionalAccess', _110 => _110.long]) });
1026
1042
  if (_optionalChain([opts, 'optionalAccess', _111 => _111.nameOnly])) {
1027
1043
  return entries.map((entry) => entry.path);
1028
1044
  }
@@ -1034,7 +1050,7 @@ var BareRepoImpl = (_class = class {
1034
1050
  async revParse(refOrOpts, opts) {
1035
1051
  const args = ["rev-parse"];
1036
1052
  if (typeof refOrOpts === "string") {
1037
- _chunk6HDMSFY7cjs.validateRevParseRefOpts.call(void 0, opts);
1053
+ _chunkRWKMVYO5cjs.validateRevParseRefOpts.call(void 0, opts);
1038
1054
  addRefOptions(args, opts);
1039
1055
  args.push(checkedOperand("revParse", "ref", refOrOpts));
1040
1056
  const result2 = await this.runner.run(this.context, args, { signal: _optionalChain([opts, 'optionalAccess', _113 => _113.signal]) });
@@ -1044,7 +1060,7 @@ var BareRepoImpl = (_class = class {
1044
1060
  this.runner.checkResult(this.context, args, result2);
1045
1061
  return result2.stdout.trim();
1046
1062
  }
1047
- _chunk6HDMSFY7cjs.validateRevParseQuery.call(void 0, refOrOpts);
1063
+ _chunkRWKMVYO5cjs.validateRevParseQuery.call(void 0, refOrOpts);
1048
1064
  if ("pathFormat" in refOrOpts && refOrOpts.pathFormat) {
1049
1065
  args.push(`--path-format=${refOrOpts.pathFormat}`);
1050
1066
  }
@@ -1082,16 +1098,16 @@ var BareRepoImpl = (_class = class {
1082
1098
  signal: _optionalChain([opts, 'optionalAccess', _115 => _115.signal])
1083
1099
  });
1084
1100
  const remotes = /* @__PURE__ */ new Map();
1085
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
1101
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
1086
1102
  parseRemoteLine(line, remotes);
1087
1103
  }
1088
1104
  normalizeRemoteUrls(remotes);
1089
1105
  return Array.from(remotes.values());
1090
1106
  }
1091
1107
  async remoteAdd(name, url, opts) {
1092
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "remoteAdd", opts);
1108
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "remoteAdd", opts);
1093
1109
  const args = ["remote", "add"];
1094
- if (_optionalChain([opts, 'optionalAccess', _116 => _116.track])) {
1110
+ if (_optionalChain([opts, 'optionalAccess', _116 => _116.track]) !== void 0) {
1095
1111
  args.push("-t", opts.track);
1096
1112
  }
1097
1113
  if (_optionalChain([opts, 'optionalAccess', _117 => _117.fetch])) {
@@ -1158,7 +1174,7 @@ var BareRepoImpl = (_class = class {
1158
1174
  });
1159
1175
  }
1160
1176
  async remoteSetHead(remote, branch, opts) {
1161
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "remoteSetHead", opts);
1177
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "remoteSetHead", opts);
1162
1178
  const args = ["remote", "set-head"];
1163
1179
  if (_optionalChain([opts, 'optionalAccess', _128 => _128.auto])) {
1164
1180
  args.push("--auto");
@@ -1166,8 +1182,14 @@ var BareRepoImpl = (_class = class {
1166
1182
  args.push("--delete");
1167
1183
  }
1168
1184
  args.push(checkedOperand("remote.setHead", "remote", remote));
1169
- if (branch && !_optionalChain([opts, 'optionalAccess', _130 => _130.auto]) && !_optionalChain([opts, 'optionalAccess', _131 => _131.delete])) {
1170
- args.push(checkedOperand("remote.setHead", "branch", branch));
1185
+ if (branch !== void 0 && !_optionalChain([opts, 'optionalAccess', _130 => _130.auto]) && !_optionalChain([opts, 'optionalAccess', _131 => _131.delete])) {
1186
+ args.push(
1187
+ checkedOperand(
1188
+ "remote.setHead",
1189
+ "branch",
1190
+ checkedOptionValue("remote.setHead", "branch", branch)
1191
+ )
1192
+ );
1171
1193
  }
1172
1194
  await this.runner.runOrThrow(this.context, args, {
1173
1195
  signal: _optionalChain([opts, 'optionalAccess', _132 => _132.signal])
@@ -1194,7 +1216,7 @@ var BareRepoImpl = (_class = class {
1194
1216
  signal: _optionalChain([opts, 'optionalAccess', _136 => _136.signal])
1195
1217
  });
1196
1218
  const pruned = [];
1197
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
1219
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
1198
1220
  const match = line.match(PRUNED_REF_PATTERN);
1199
1221
  const ref = _optionalChain([match, 'optionalAccess', _137 => _137[1]]);
1200
1222
  if (ref) {
@@ -1351,7 +1373,7 @@ function data(stdout) {
1351
1373
  }
1352
1374
  } catch (e) {
1353
1375
  }
1354
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid Git LFS JSON", { stdout });
1376
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid Git LFS JSON", { stdout });
1355
1377
  }
1356
1378
  function validSize(value) {
1357
1379
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
@@ -1359,12 +1381,12 @@ function validSize(value) {
1359
1381
  function parseLfsStatusJson(stdout) {
1360
1382
  const files = data(stdout).files;
1361
1383
  if (!record(files)) {
1362
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Missing Git LFS status files");
1384
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Missing Git LFS status files");
1363
1385
  }
1364
1386
  return {
1365
1387
  files: Object.entries(files).map(([name, value]) => {
1366
1388
  if (!record(value) || typeof value.status !== "string" || value.size !== void 0 && !validSize(value.size)) {
1367
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid Git LFS status entry");
1389
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid Git LFS status entry");
1368
1390
  }
1369
1391
  return { name, status: value.status, ...validSize(value.size) ? { size: value.size } : {} };
1370
1392
  })
@@ -1376,11 +1398,11 @@ function parseLfsFilesJson(stdout) {
1376
1398
  return [];
1377
1399
  }
1378
1400
  if (!Array.isArray(files)) {
1379
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Missing Git LFS file list");
1401
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Missing Git LFS file list");
1380
1402
  }
1381
1403
  return files.map((value) => {
1382
1404
  if (!record(value) || typeof value.name !== "string" || typeof value.oid !== "string" || !/^[a-f0-9]{64}$/.test(value.oid) || typeof value.checkout !== "boolean" || !validSize(value.size)) {
1383
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid Git LFS file entry");
1405
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid Git LFS file entry");
1384
1406
  }
1385
1407
  return {
1386
1408
  path: value.name,
@@ -1447,7 +1469,7 @@ var PRE_UPLOAD_DEFAULT_CONCURRENCY = 4;
1447
1469
  var PRE_UPLOAD_WARMUP_BATCH_COUNT = 1;
1448
1470
  function stashEntry(index, command) {
1449
1471
  if (!Number.isInteger(index) || index < 0 || index >= 1e8) {
1450
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
1472
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
1451
1473
  `${command}: index must be an integer from 0 to 99999999 (got ${index})`
1452
1474
  );
1453
1475
  }
@@ -1470,7 +1492,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1470
1492
  constructor(runner, workdir, options) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
1471
1493
  this.runner = runner;
1472
1494
  this.workdir = workdir;
1473
- _chunk6HDMSFY7cjs.registerCommandHost.call(void 0, this, () => ({
1495
+ _chunkRWKMVYO5cjs.registerCommandHost.call(void 0, this, () => ({
1474
1496
  runner: this.runner,
1475
1497
  context: this.context,
1476
1498
  inRepository: true
@@ -1605,7 +1627,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1605
1627
  * List references in a remote repository
1606
1628
  */
1607
1629
  async lsRemote(remote, opts) {
1608
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lsRemote", opts);
1630
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lsRemote", opts);
1609
1631
  const args = ["ls-remote"];
1610
1632
  if (_optionalChain([opts, 'optionalAccess', _151 => _151.heads])) {
1611
1633
  args.push("--heads");
@@ -1616,8 +1638,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1616
1638
  if (_optionalChain([opts, 'optionalAccess', _153 => _153.refsOnly])) {
1617
1639
  args.push("--refs");
1618
1640
  }
1619
- if (_optionalChain([opts, 'optionalAccess', _154 => _154.sort])) {
1620
- args.push("--sort", opts.sort);
1641
+ if (_optionalChain([opts, 'optionalAccess', _154 => _154.sort]) !== void 0) {
1642
+ args.push("--sort", checkedOptionValue("lsRemote", "sort", opts.sort));
1621
1643
  }
1622
1644
  args.push(checkedOperand("lsRemote", "remote", remote));
1623
1645
  if (_optionalChain([opts, 'optionalAccess', _155 => _155.refs]) && opts.refs.length > 0) {
@@ -1627,11 +1649,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1627
1649
  signal: _optionalChain([opts, 'optionalAccess', _156 => _156.signal]),
1628
1650
  onProgress: _optionalChain([opts, 'optionalAccess', _157 => _157.onProgress])
1629
1651
  });
1630
- const refs = _chunk6HDMSFY7cjs.parseLsRemote.call(void 0, result.stdout);
1652
+ const refs = _chunkRWKMVYO5cjs.parseLsRemote.call(void 0, result.stdout);
1631
1653
  return { refs };
1632
1654
  }
1633
1655
  async lsTree(treeish, opts) {
1634
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lsTree", opts);
1656
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lsTree", opts);
1635
1657
  const args = ["ls-tree", "-z"];
1636
1658
  if (_optionalChain([opts, 'optionalAccess', _158 => _158.recursive])) {
1637
1659
  args.push("-r");
@@ -1665,7 +1687,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1665
1687
  const result = await this.runner.runOrThrow(this.context, args, {
1666
1688
  signal: _optionalChain([opts, 'optionalAccess', _166 => _166.signal])
1667
1689
  });
1668
- const entries = _chunk6HDMSFY7cjs.parseLsTree.call(void 0, result.stdout, { long: _optionalChain([opts, 'optionalAccess', _167 => _167.long]) });
1690
+ const entries = _chunkRWKMVYO5cjs.parseLsTree.call(void 0, result.stdout, { long: _optionalChain([opts, 'optionalAccess', _167 => _167.long]) });
1669
1691
  if (_optionalChain([opts, 'optionalAccess', _168 => _168.nameOnly])) {
1670
1692
  return entries.map((entry) => entry.path);
1671
1693
  }
@@ -1678,7 +1700,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1678
1700
  * Get repository status
1679
1701
  */
1680
1702
  async status(opts) {
1681
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "status", opts);
1703
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "status", opts);
1682
1704
  const args = ["status", "--porcelain=v2", "-z"];
1683
1705
  if (_optionalChain([opts, 'optionalAccess', _170 => _170.untracked])) {
1684
1706
  switch (opts.untracked) {
@@ -1733,7 +1755,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1733
1755
  }
1734
1756
  parseStatus(stdout) {
1735
1757
  const result = {
1736
- entries: _chunk6HDMSFY7cjs.parsePorcelainV2.call(void 0, stdout).map((entry) => {
1758
+ entries: _chunkRWKMVYO5cjs.parsePorcelainV2.call(void 0, stdout).map((entry) => {
1737
1759
  if (entry.type === "untracked" || entry.type === "ignored") {
1738
1760
  const status = entry.type === "untracked" ? "?" : "!";
1739
1761
  return { path: entry.path, index: status, workdir: status };
@@ -1746,7 +1768,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1746
1768
  };
1747
1769
  })
1748
1770
  };
1749
- const records = stdout.includes("\0") ? _chunk6HDMSFY7cjs.parseRecords.call(void 0, stdout) : _chunk6HDMSFY7cjs.parseLines.call(void 0, stdout, { trim: false });
1771
+ const records = stdout.includes("\0") ? _chunkRWKMVYO5cjs.parseRecords.call(void 0, stdout) : _chunkRWKMVYO5cjs.parseLines.call(void 0, stdout, { trim: false });
1750
1772
  for (let i = 0; i < records.length; i++) {
1751
1773
  const line = records[i];
1752
1774
  if (line.startsWith("2 ") && stdout.includes("\0")) {
@@ -1774,8 +1796,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1774
1796
  * Get commit log
1775
1797
  */
1776
1798
  async log(opts) {
1777
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "log", opts);
1778
- const format = _optionalChain([opts, 'optionalAccess', _178 => _178.useMailmap]) ? _chunk6HDMSFY7cjs.GIT_LOG_FORMAT.replace("%an", "%aN").replace("%ae", "%aE").replace("%cn", "%cN").replace("%ce", "%cE") : _chunk6HDMSFY7cjs.GIT_LOG_FORMAT;
1799
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "log", opts);
1800
+ const format = _optionalChain([opts, 'optionalAccess', _178 => _178.useMailmap]) ? _chunkRWKMVYO5cjs.GIT_LOG_FORMAT.replace("%an", "%aN").replace("%ae", "%aE").replace("%cn", "%cN").replace("%ce", "%cE") : _chunkRWKMVYO5cjs.GIT_LOG_FORMAT;
1779
1801
  const args = [
1780
1802
  "log",
1781
1803
  "-z",
@@ -1792,19 +1814,19 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1792
1814
  if (_optionalChain([opts, 'optionalAccess', _180 => _180.skip]) !== void 0) {
1793
1815
  args.push(`--skip=${opts.skip}`);
1794
1816
  }
1795
- if (_optionalChain([opts, 'optionalAccess', _181 => _181.since])) {
1817
+ if (_optionalChain([opts, 'optionalAccess', _181 => _181.since]) !== void 0) {
1796
1818
  const since = opts.since instanceof Date ? opts.since.toISOString() : opts.since;
1797
1819
  args.push(`--since=${since}`);
1798
1820
  }
1799
- if (_optionalChain([opts, 'optionalAccess', _182 => _182.after])) {
1821
+ if (_optionalChain([opts, 'optionalAccess', _182 => _182.after]) !== void 0) {
1800
1822
  const after = opts.after instanceof Date ? opts.after.toISOString() : opts.after;
1801
1823
  args.push(`--after=${after}`);
1802
1824
  }
1803
- if (_optionalChain([opts, 'optionalAccess', _183 => _183.until])) {
1825
+ if (_optionalChain([opts, 'optionalAccess', _183 => _183.until]) !== void 0) {
1804
1826
  const until = opts.until instanceof Date ? opts.until.toISOString() : opts.until;
1805
1827
  args.push(`--until=${until}`);
1806
1828
  }
1807
- if (_optionalChain([opts, 'optionalAccess', _184 => _184.before])) {
1829
+ if (_optionalChain([opts, 'optionalAccess', _184 => _184.before]) !== void 0) {
1808
1830
  const before = opts.before instanceof Date ? opts.before.toISOString() : opts.before;
1809
1831
  args.push(`--before=${before}`);
1810
1832
  }
@@ -1835,13 +1857,13 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1835
1857
  if (_optionalChain([opts, 'optionalAccess', _193 => _193.reverse])) {
1836
1858
  args.push("--reverse");
1837
1859
  }
1838
- if (_optionalChain([opts, 'optionalAccess', _194 => _194.ref])) {
1839
- args.push(checkedOperand("log", "ref", opts.ref));
1860
+ if (_optionalChain([opts, 'optionalAccess', _194 => _194.ref]) !== void 0) {
1861
+ args.push(checkedRevision("log", "ref", opts.ref));
1840
1862
  }
1841
1863
  const result = await this.runner.runOrThrow(this.context, args, {
1842
1864
  signal: _optionalChain([opts, 'optionalAccess', _195 => _195.signal])
1843
1865
  });
1844
- const parsed = _chunk6HDMSFY7cjs.parseGitLog.call(void 0, result.stdout);
1866
+ const parsed = _chunkRWKMVYO5cjs.parseGitLog.call(void 0, result.stdout);
1845
1867
  return parsed.map((p) => ({
1846
1868
  hash: p.hash,
1847
1869
  abbrevHash: p.abbrevHash,
@@ -1905,7 +1927,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1905
1927
  // LFS Operations
1906
1928
  // ==========================================================================
1907
1929
  async lfsPull(opts) {
1908
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsPull", opts);
1930
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsPull", opts);
1909
1931
  if (this._lfsMode === "disabled") {
1910
1932
  return;
1911
1933
  }
@@ -1926,7 +1948,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1926
1948
  });
1927
1949
  }
1928
1950
  async lfsPush(opts) {
1929
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsPush", opts);
1951
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsPush", opts);
1930
1952
  if (this._lfsMode === "disabled") {
1931
1953
  return;
1932
1954
  }
@@ -1960,7 +1982,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
1960
1982
  });
1961
1983
  }
1962
1984
  async lfsStatus(opts) {
1963
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsStatus", opts);
1985
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsStatus", opts);
1964
1986
  const result = await this.runner.runOrThrow(this.context, ["lfs", "status", "--json"], opts);
1965
1987
  return parseLfsStatusJson(result.stdout);
1966
1988
  }
@@ -2010,7 +2032,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2010
2032
  return { uploadedCount: 0, uploadedBytes: 0, skippedCount: 0 };
2011
2033
  }
2012
2034
  oids = [];
2013
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, lsFilesResult.stdout)) {
2035
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, lsFilesResult.stdout)) {
2014
2036
  const match = line.match(/^([a-f0-9]{64})\s+[-*]\s+/);
2015
2037
  const oid = _optionalChain([match, 'optionalAccess', _219 => _219[1]]);
2016
2038
  if (oid !== void 0) {
@@ -2107,7 +2129,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2107
2129
  return { downloadedCount: 0, downloadedBytes: 0, skippedCount: 0 };
2108
2130
  }
2109
2131
  oids = [];
2110
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, lsFilesResult.stdout)) {
2132
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, lsFilesResult.stdout)) {
2111
2133
  const match = line.match(/^([a-f0-9]{64})\s+[-*]\s+/);
2112
2134
  const oid = _optionalChain([match, 'optionalAccess', _232 => _232[1]]);
2113
2135
  if (oid !== void 0) {
@@ -2190,7 +2212,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2190
2212
  });
2191
2213
  }
2192
2214
  async lfsFetch(opts) {
2193
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsFetch", opts);
2215
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsFetch", opts);
2194
2216
  if (this._lfsMode === "disabled") {
2195
2217
  return;
2196
2218
  }
@@ -2263,7 +2285,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2263
2285
  });
2264
2286
  }
2265
2287
  async lfsLsFiles(opts) {
2266
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsLsFiles", opts);
2288
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsLsFiles", opts);
2267
2289
  if (this._lfsMode === "disabled") {
2268
2290
  return [];
2269
2291
  }
@@ -2288,8 +2310,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2288
2310
  const patterns = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
2289
2311
  args.push("--exclude", patterns.join(","));
2290
2312
  }
2291
- if (_optionalChain([opts, 'optionalAccess', _275 => _275.ref])) {
2292
- args.push(checkedOperand("lfs.lsFiles", "ref", opts.ref));
2313
+ if (_optionalChain([opts, 'optionalAccess', _275 => _275.ref]) !== void 0) {
2314
+ args.push(checkedRevision("lfs.lsFiles", "ref", opts.ref));
2293
2315
  }
2294
2316
  const result = await this.runner.runOrThrow(this.context, args, {
2295
2317
  signal: _optionalChain([opts, 'optionalAccess', _276 => _276.signal])
@@ -2327,7 +2349,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2327
2349
  signal: _optionalChain([opts, 'optionalAccess', _283 => _283.signal])
2328
2350
  });
2329
2351
  const entries = [];
2330
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
2352
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
2331
2353
  const match = line.match(/^\s+(\S+)\s+\(([^)]+)\)(?:\s+\[lockable\])?$/);
2332
2354
  if (match) {
2333
2355
  entries.push({
@@ -2390,7 +2412,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2390
2412
  if (this._lfsMode === "disabled") {
2391
2413
  return [];
2392
2414
  }
2393
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsLocks", opts);
2415
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsLocks", opts);
2394
2416
  const args = ["lfs", "locks", "--json"];
2395
2417
  if (_optionalChain([opts, 'optionalAccess', _291 => _291.verify])) {
2396
2418
  args.push("--verify");
@@ -2437,8 +2459,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2437
2459
  return;
2438
2460
  }
2439
2461
  const args = ["lfs", "checkout"];
2440
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsCheckout", opts);
2441
- _chunk6HDMSFY7cjs.validateInput.call(void 0, "lfsCheckout", { ...opts, patterns });
2462
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsCheckout", opts);
2463
+ _chunkRWKMVYO5cjs.validateInput.call(void 0, "lfsCheckout", { ...opts, patterns });
2442
2464
  for (const stage of ["base", "ours", "theirs"]) {
2443
2465
  if (_optionalChain([opts, 'optionalAccess', _301 => _301[stage]])) {
2444
2466
  args.push(`--${stage}`);
@@ -2457,7 +2479,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2457
2479
  });
2458
2480
  }
2459
2481
  async lfsMigrateInfo(opts) {
2460
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsMigrateInfo", opts);
2482
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsMigrateInfo", opts);
2461
2483
  if (this._lfsMode === "disabled") {
2462
2484
  return "";
2463
2485
  }
@@ -2478,7 +2500,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2478
2500
  return result.stdout;
2479
2501
  }
2480
2502
  async lfsMigrateImport(opts) {
2481
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsMigrateImport", opts);
2503
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsMigrateImport", opts);
2482
2504
  if (this._lfsMode === "disabled") {
2483
2505
  return;
2484
2506
  }
@@ -2512,7 +2534,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2512
2534
  });
2513
2535
  }
2514
2536
  async lfsMigrateExport(opts) {
2515
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lfsMigrateExport", opts);
2537
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lfsMigrateExport", opts);
2516
2538
  if (this._lfsMode === "disabled") {
2517
2539
  return;
2518
2540
  }
@@ -2572,7 +2594,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2572
2594
  lfsVersion: "",
2573
2595
  endpoint: ""
2574
2596
  };
2575
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
2597
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
2576
2598
  if (line.startsWith("git version")) {
2577
2599
  info.gitVersion = line.replace("git version ", "").trim();
2578
2600
  } else if (line.startsWith("git-lfs/")) {
@@ -2646,10 +2668,10 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2646
2668
  const result = await this.runner.runOrThrow(this.context, ["worktree", "list", "--porcelain"], {
2647
2669
  signal: _optionalChain([opts, 'optionalAccess', _332 => _332.signal])
2648
2670
  });
2649
- return _chunk6HDMSFY7cjs.parseWorktreeList.call(void 0, result.stdout);
2671
+ return _chunkRWKMVYO5cjs.parseWorktreeList.call(void 0, result.stdout);
2650
2672
  }
2651
2673
  async worktreeAdd(path, opts) {
2652
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "worktreeAdd", opts);
2674
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "worktreeAdd", opts);
2653
2675
  const args = ["worktree", "add"];
2654
2676
  if (_optionalChain([opts, 'optionalAccess', _333 => _333.detach])) {
2655
2677
  args.push("--detach");
@@ -2675,8 +2697,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2675
2697
  args.push("-b", opts.branch);
2676
2698
  }
2677
2699
  args.push(checkedOperand("worktree.add", "path", path));
2678
- if (_optionalChain([opts, 'optionalAccess', _341 => _341.commitish])) {
2679
- args.push(checkedOperand("worktree.add", "commitish", opts.commitish));
2700
+ if (_optionalChain([opts, 'optionalAccess', _341 => _341.commitish]) !== void 0) {
2701
+ args.push(checkedRevision("worktree.add", "commitish", opts.commitish));
2680
2702
  }
2681
2703
  await this.runner.runOrThrow(this.context, args, {
2682
2704
  signal: _optionalChain([opts, 'optionalAccess', _342 => _342.signal]),
@@ -2702,13 +2724,13 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2702
2724
  if (_optionalChain([opts, 'optionalAccess', _347 => _347.verbose])) {
2703
2725
  args.push("--verbose");
2704
2726
  }
2705
- if (_optionalChain([opts, 'optionalAccess', _348 => _348.expire])) {
2706
- args.push(`--expire=${opts.expire}`);
2727
+ if (_optionalChain([opts, 'optionalAccess', _348 => _348.expire]) !== void 0) {
2728
+ args.push(`--expire=${checkedOptionValue("worktree.prune", "expire", opts.expire)}`);
2707
2729
  }
2708
2730
  const result = await this.runner.runOrThrow(this.context, args, {
2709
2731
  signal: _optionalChain([opts, 'optionalAccess', _349 => _349.signal])
2710
2732
  });
2711
- return _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout);
2733
+ return _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout);
2712
2734
  }
2713
2735
  async worktreeLock(path, opts) {
2714
2736
  const args = ["worktree", "lock"];
@@ -2753,8 +2775,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2753
2775
  });
2754
2776
  }
2755
2777
  async add(paths, opts) {
2756
- _chunk6HDMSFY7cjs.validatePathInput.call(void 0, "add", paths, opts);
2757
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "add", opts);
2778
+ _chunkRWKMVYO5cjs.validatePathInput.call(void 0, "add", paths, opts);
2779
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "add", opts);
2758
2780
  const args = ["add"];
2759
2781
  if (_optionalChain([opts, 'optionalAccess', _356 => _356.verbose])) {
2760
2782
  args.push("--verbose");
@@ -2795,7 +2817,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2795
2817
  if (_optionalChain([opts, 'optionalAccess', _368 => _368.chmod])) {
2796
2818
  args.push(`--chmod=${opts.chmod}`);
2797
2819
  }
2798
- if (_optionalChain([opts, 'optionalAccess', _369 => _369.pathspecFromFile])) {
2820
+ if (_optionalChain([opts, 'optionalAccess', _369 => _369.pathspecFromFile]) !== void 0) {
2799
2821
  args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
2800
2822
  }
2801
2823
  const pathList = Array.isArray(paths) ? paths : [paths];
@@ -2822,26 +2844,28 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2822
2844
  if (_optionalChain([opts, 'optionalAccess', _373 => _373.quiet])) {
2823
2845
  args.push("--quiet");
2824
2846
  }
2825
- if (_optionalChain([opts, 'optionalAccess', _374 => _374.contains])) {
2826
- args.push(`--contains=${opts.contains}`);
2847
+ if (_optionalChain([opts, 'optionalAccess', _374 => _374.contains]) !== void 0) {
2848
+ args.push(`--contains=${checkedOptionValue("branch.list", "contains", opts.contains)}`);
2827
2849
  }
2828
- if (_optionalChain([opts, 'optionalAccess', _375 => _375.noContains])) {
2829
- args.push(`--no-contains=${opts.noContains}`);
2850
+ if (_optionalChain([opts, 'optionalAccess', _375 => _375.noContains]) !== void 0) {
2851
+ args.push(
2852
+ `--no-contains=${checkedOptionValue("branch.list", "noContains", opts.noContains)}`
2853
+ );
2830
2854
  }
2831
2855
  if (_optionalChain([opts, 'optionalAccess', _376 => _376.abbrev]) !== void 0) {
2832
2856
  args.push(`--abbrev=${opts.abbrev}`);
2833
2857
  }
2834
- if (_optionalChain([opts, 'optionalAccess', _377 => _377.merged])) {
2835
- args.push(`--merged=${opts.merged}`);
2858
+ if (_optionalChain([opts, 'optionalAccess', _377 => _377.merged]) !== void 0) {
2859
+ args.push(`--merged=${checkedOptionValue("branch.list", "merged", opts.merged)}`);
2836
2860
  }
2837
- if (_optionalChain([opts, 'optionalAccess', _378 => _378.noMerged])) {
2838
- args.push(`--no-merged=${opts.noMerged}`);
2861
+ if (_optionalChain([opts, 'optionalAccess', _378 => _378.noMerged]) !== void 0) {
2862
+ args.push(`--no-merged=${checkedOptionValue("branch.list", "noMerged", opts.noMerged)}`);
2839
2863
  }
2840
2864
  if (_optionalChain([opts, 'optionalAccess', _379 => _379.sort]) !== void 0) {
2841
2865
  args.push(`--sort=${checkedRefSortKey("branch.list", opts.sort)}`);
2842
2866
  }
2843
- if (_optionalChain([opts, 'optionalAccess', _380 => _380.pointsAt])) {
2844
- args.push(`--points-at=${opts.pointsAt}`);
2867
+ if (_optionalChain([opts, 'optionalAccess', _380 => _380.pointsAt]) !== void 0) {
2868
+ args.push(`--points-at=${checkedOptionValue("branch.list", "pointsAt", opts.pointsAt)}`);
2845
2869
  }
2846
2870
  if (_optionalChain([opts, 'optionalAccess', _381 => _381.ignoreCase])) {
2847
2871
  args.push("--ignore-case");
@@ -2850,7 +2874,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2850
2874
  signal: _optionalChain([opts, 'optionalAccess', _382 => _382.signal])
2851
2875
  });
2852
2876
  const branches = [];
2853
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
2877
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
2854
2878
  const parts = line.split("\0");
2855
2879
  const name = parts[0];
2856
2880
  const commit = parts[1];
@@ -2881,7 +2905,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2881
2905
  async branchCreate(name, opts) {
2882
2906
  const args = ["branch"];
2883
2907
  if (_optionalChain([opts, 'optionalAccess', _385 => _385.setUpstreamTo]) && opts.recurseSubmodules) {
2884
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
2908
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
2885
2909
  "branch.create: setUpstreamTo cannot be combined with recurseSubmodules"
2886
2910
  );
2887
2911
  }
@@ -2899,8 +2923,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2899
2923
  }
2900
2924
  args.push(checkedOperand("branch.create", "name", name));
2901
2925
  checkedNewBranchName("branch.create", "name", name);
2902
- if (_optionalChain([opts, 'optionalAccess', _390 => _390.startPoint])) {
2903
- args.push(checkedOperand("branch.create", "startPoint", opts.startPoint));
2926
+ if (_optionalChain([opts, 'optionalAccess', _390 => _390.startPoint]) !== void 0) {
2927
+ args.push(checkedRevision("branch.create", "startPoint", opts.startPoint));
2904
2928
  }
2905
2929
  await this.runner.runOrThrow(this.context, args, {
2906
2930
  signal: _optionalChain([opts, 'optionalAccess', _391 => _391.signal])
@@ -2952,11 +2976,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2952
2976
  }
2953
2977
  // Implementation
2954
2978
  async checkout(targetOrPaths, opts) {
2955
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, Array.isArray(targetOrPaths) ? "checkoutPath" : "checkoutBranch", opts);
2979
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, Array.isArray(targetOrPaths) ? "checkoutPath" : "checkoutBranch", opts);
2956
2980
  const args = ["checkout"];
2957
2981
  const isPathMode = Array.isArray(targetOrPaths);
2958
2982
  if (isPathMode) {
2959
- _chunk6HDMSFY7cjs.validatePathInput.call(void 0, "checkout", targetOrPaths, opts);
2983
+ _chunkRWKMVYO5cjs.validatePathInput.call(void 0, "checkout", targetOrPaths, opts);
2960
2984
  const pathOpts = opts;
2961
2985
  if (_optionalChain([pathOpts, 'optionalAccess', _398 => _398.force])) {
2962
2986
  args.push("--force");
@@ -2973,11 +2997,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
2973
2997
  if (_optionalChain([pathOpts, 'optionalAccess', _402 => _402.theirs])) {
2974
2998
  args.push("--theirs");
2975
2999
  }
2976
- if (_optionalChain([pathOpts, 'optionalAccess', _403 => _403.pathspecFromFile])) {
3000
+ if (_optionalChain([pathOpts, 'optionalAccess', _403 => _403.pathspecFromFile]) !== void 0) {
2977
3001
  args.push(`--pathspec-from-file=${pathOpts.pathspecFromFile}`);
2978
3002
  }
2979
- if (_optionalChain([pathOpts, 'optionalAccess', _404 => _404.source])) {
2980
- args.push(checkedOperand("checkout", "source", pathOpts.source));
3003
+ if (_optionalChain([pathOpts, 'optionalAccess', _404 => _404.source]) !== void 0) {
3004
+ args.push(checkedRevision("checkout", "source", pathOpts.source));
2981
3005
  }
2982
3006
  args.push("--");
2983
3007
  args.push(...targetOrPaths);
@@ -3025,8 +3049,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3025
3049
  args.push("--ignore-other-worktrees");
3026
3050
  }
3027
3051
  args.push(checkedOperand("checkout", "target", targetOrPaths));
3028
- if (_optionalChain([branchOpts, 'optionalAccess', _419 => _419.startPoint])) {
3029
- args.push(checkedOperand("checkout", "startPoint", branchOpts.startPoint));
3052
+ if (_optionalChain([branchOpts, 'optionalAccess', _419 => _419.startPoint]) !== void 0) {
3053
+ args.push(checkedRevision("checkout", "startPoint", branchOpts.startPoint));
3030
3054
  }
3031
3055
  }
3032
3056
  await this.runner.runOrThrow(this.context, args, {
@@ -3038,10 +3062,10 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3038
3062
  // High-level API - commit
3039
3063
  // ==========================================================================
3040
3064
  async commit(opts) {
3041
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "commit", opts);
3042
- _chunk6HDMSFY7cjs.validateInput.call(void 0, "commitPaths", { ...opts }, "commit");
3065
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "commit", opts);
3066
+ _chunkRWKMVYO5cjs.validateInput.call(void 0, "commitPaths", { ...opts }, "commit");
3043
3067
  const args = ["commit"];
3044
- if (_optionalChain([opts, 'optionalAccess', _421 => _421.message])) {
3068
+ if (_optionalChain([opts, 'optionalAccess', _421 => _421.message]) !== void 0) {
3045
3069
  args.push("-m", opts.message);
3046
3070
  }
3047
3071
  if (_optionalChain([opts, 'optionalAccess', _422 => _422.allowEmpty])) {
@@ -3053,12 +3077,12 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3053
3077
  if (_optionalChain([opts, 'optionalAccess', _424 => _424.all])) {
3054
3078
  args.push("-a");
3055
3079
  }
3056
- if (_optionalChain([opts, 'optionalAccess', _425 => _425.author])) {
3080
+ if (_optionalChain([opts, 'optionalAccess', _425 => _425.author]) !== void 0) {
3057
3081
  args.push("--author", opts.author);
3058
3082
  }
3059
- if (_optionalChain([opts, 'optionalAccess', _426 => _426.date])) {
3083
+ if (_optionalChain([opts, 'optionalAccess', _426 => _426.date]) !== void 0) {
3060
3084
  const date = opts.date instanceof Date ? opts.date.toISOString() : opts.date;
3061
- args.push("--date", date);
3085
+ args.push("--date", checkedOptionValue("commit", "date", date));
3062
3086
  }
3063
3087
  if (_optionalChain([opts, 'optionalAccess', _427 => _427.noVerify])) {
3064
3088
  args.push("--no-verify");
@@ -3075,17 +3099,17 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3075
3099
  if (_optionalChain([opts, 'optionalAccess', _431 => _431.verbose])) {
3076
3100
  args.push("--verbose");
3077
3101
  }
3078
- if (_optionalChain([opts, 'optionalAccess', _432 => _432.file])) {
3079
- args.push("--file", opts.file);
3102
+ if (_optionalChain([opts, 'optionalAccess', _432 => _432.file]) !== void 0) {
3103
+ args.push("--file", checkedOptionValue("commit", "file", opts.file));
3080
3104
  }
3081
- if (_optionalChain([opts, 'optionalAccess', _433 => _433.reuseMessage])) {
3082
- args.push("--reuse-message", opts.reuseMessage);
3105
+ if (_optionalChain([opts, 'optionalAccess', _433 => _433.reuseMessage]) !== void 0) {
3106
+ args.push("--reuse-message", checkedOptionValue("commit", "reuseMessage", opts.reuseMessage));
3083
3107
  }
3084
- if (_optionalChain([opts, 'optionalAccess', _434 => _434.fixup])) {
3085
- args.push("--fixup", opts.fixup);
3108
+ if (_optionalChain([opts, 'optionalAccess', _434 => _434.fixup]) !== void 0) {
3109
+ args.push("--fixup", checkedOptionValue("commit", "fixup", opts.fixup));
3086
3110
  }
3087
- if (_optionalChain([opts, 'optionalAccess', _435 => _435.squash])) {
3088
- args.push("--squash", opts.squash);
3111
+ if (_optionalChain([opts, 'optionalAccess', _435 => _435.squash]) !== void 0) {
3112
+ args.push("--squash", checkedOptionValue("commit", "squash", opts.squash));
3089
3113
  }
3090
3114
  if (_optionalChain([opts, 'optionalAccess', _436 => _436.resetAuthor])) {
3091
3115
  args.push("--reset-author");
@@ -3114,7 +3138,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3114
3138
  if (_optionalChain([opts, 'optionalAccess', _443 => _443.untrackedFiles])) {
3115
3139
  args.push(`--untracked-files=${opts.untrackedFiles}`);
3116
3140
  }
3117
- if (_optionalChain([opts, 'optionalAccess', _444 => _444.pathspecFromFile])) {
3141
+ if (_optionalChain([opts, 'optionalAccess', _444 => _444.pathspecFromFile]) !== void 0) {
3118
3142
  args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
3119
3143
  }
3120
3144
  if (_optionalChain([opts, 'optionalAccess', _445 => _445.allowEmptyMessage])) {
@@ -3139,12 +3163,12 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3139
3163
  ["diff-tree", "--root", "--no-commit-id", "--numstat", "-r", "-z", "-M", hash],
3140
3164
  opts
3141
3165
  );
3142
- const records = _chunk6HDMSFY7cjs.parseRecords.call(void 0, stats.stdout);
3166
+ const records = _chunkRWKMVYO5cjs.parseRecords.call(void 0, stats.stdout);
3143
3167
  for (let i = 0; i < records.length; i++) {
3144
3168
  const record2 = records[i];
3145
3169
  const match = record2.match(/^(\d+|-)\t(\d+|-)\t([\s\S]*)$/);
3146
3170
  if (!match) {
3147
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid commit numstat record");
3171
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid commit numstat record");
3148
3172
  }
3149
3173
  filesChanged++;
3150
3174
  if (match[1] !== "-") {
@@ -3171,7 +3195,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3171
3195
  };
3172
3196
  }
3173
3197
  async diff(target, opts) {
3174
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "diff", opts);
3198
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "diff", opts);
3175
3199
  const args = ["diff", "--no-ext-diff", "--no-textconv", "--no-color"];
3176
3200
  if (_optionalChain([opts, 'optionalAccess', _449 => _449.nameOnly]) || _optionalChain([opts, 'optionalAccess', _450 => _450.nameStatus])) {
3177
3201
  args.push("-z");
@@ -3245,8 +3269,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3245
3269
  if (_optionalChain([opts, 'optionalAccess', _469 => _469.renameLimit]) !== void 0) {
3246
3270
  args.push(`-l${opts.renameLimit}`);
3247
3271
  }
3248
- if (_optionalChain([opts, 'optionalAccess', _470 => _470.pickaxe])) {
3249
- args.push(`-S${opts.pickaxe}`);
3272
+ if (_optionalChain([opts, 'optionalAccess', _470 => _470.pickaxe]) !== void 0) {
3273
+ args.push(...opts.pickaxe === "" ? ["-S", ""] : [`-S${opts.pickaxe}`]);
3250
3274
  }
3251
3275
  if (_optionalChain([opts, 'optionalAccess', _471 => _471.pickaxeAll])) {
3252
3276
  args.push("--pickaxe-all");
@@ -3260,8 +3284,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3260
3284
  if (_optionalChain([opts, 'optionalAccess', _474 => _474.wordDiff])) {
3261
3285
  args.push(`--word-diff=${opts.wordDiff}`);
3262
3286
  }
3263
- if (target) {
3264
- args.push(checkedOperand("diff", "target", target));
3287
+ if (target !== void 0) {
3288
+ args.push(checkedRevision("diff", "target", target));
3265
3289
  }
3266
3290
  if (_optionalChain([opts, 'optionalAccess', _475 => _475.paths]) && opts.paths.length > 0) {
3267
3291
  args.push("--", ...opts.paths);
@@ -3270,21 +3294,21 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3270
3294
  signal: _optionalChain([opts, 'optionalAccess', _476 => _476.signal])
3271
3295
  });
3272
3296
  if (_optionalChain([opts, 'optionalAccess', _477 => _477.nameOnly])) {
3273
- return _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
3297
+ return _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
3274
3298
  }
3275
3299
  if (_optionalChain([opts, 'optionalAccess', _478 => _478.nameStatus])) {
3276
- const records = _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
3300
+ const records = _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
3277
3301
  const files = [];
3278
3302
  for (let i = 0; i < records.length; ) {
3279
3303
  const code = records[i++];
3280
3304
  if (!/^[AMDRTCUXB][0-9]*$/.test(code)) {
3281
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid diff status");
3305
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid diff status");
3282
3306
  }
3283
3307
  const oldPath = records[i++];
3284
3308
  const renamed = code[0] === "R" || code[0] === "C";
3285
3309
  const path = renamed ? records[i++] : oldPath;
3286
3310
  if (oldPath === void 0 || path === void 0) {
3287
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Missing diff path");
3311
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Missing diff path");
3288
3312
  }
3289
3313
  files.push({
3290
3314
  status: code[0],
@@ -3300,7 +3324,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3300
3324
  // High-level API - merge
3301
3325
  // ==========================================================================
3302
3326
  async merge(branch, opts) {
3303
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "merge", opts);
3327
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "merge", opts);
3304
3328
  if (_optionalChain([opts, 'optionalAccess', _479 => _479.abort])) {
3305
3329
  await this.runner.runOrThrow(this.context, ["merge", "--abort"], {
3306
3330
  signal: _optionalChain([opts, 'optionalAccess', _480 => _480.signal])
@@ -3319,7 +3343,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3319
3343
  return { success: true };
3320
3344
  }
3321
3345
  const args = ["merge"];
3322
- if (_optionalChain([opts, 'optionalAccess', _484 => _484.message])) {
3346
+ if (_optionalChain([opts, 'optionalAccess', _484 => _484.message]) !== void 0) {
3323
3347
  args.push("-m", opts.message);
3324
3348
  }
3325
3349
  if (_optionalChain([opts, 'optionalAccess', _485 => _485.ff]) === "only") {
@@ -3333,8 +3357,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3333
3357
  if (_optionalChain([opts, 'optionalAccess', _489 => _489.noCommit])) {
3334
3358
  args.push("--no-commit");
3335
3359
  }
3336
- if (_optionalChain([opts, 'optionalAccess', _490 => _490.strategy])) {
3337
- args.push("-s", opts.strategy);
3360
+ if (_optionalChain([opts, 'optionalAccess', _490 => _490.strategy]) !== void 0) {
3361
+ args.push("-s", checkedOptionValue("merge", "strategy", opts.strategy));
3338
3362
  }
3339
3363
  if (_optionalChain([opts, 'optionalAccess', _491 => _491.strategyOption])) {
3340
3364
  const strategyOpts = Array.isArray(opts.strategyOption) ? opts.strategyOption : [opts.strategyOption];
@@ -3394,7 +3418,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3394
3418
  if (_optionalChain([opts, 'optionalAccess', _506 => _506.signoff])) {
3395
3419
  args.push("--signoff");
3396
3420
  }
3397
- if (_optionalChain([opts, 'optionalAccess', _507 => _507.intoName])) {
3421
+ if (_optionalChain([opts, 'optionalAccess', _507 => _507.intoName]) !== void 0) {
3398
3422
  args.push(`--into-name=${opts.intoName}`);
3399
3423
  }
3400
3424
  args.push(checkedOperand("merge", "branch", branch));
@@ -3411,7 +3435,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3411
3435
  ["status", "--porcelain=v2", "-z"],
3412
3436
  { signal: _optionalChain([opts, 'optionalAccess', _509 => _509.signal]) }
3413
3437
  );
3414
- const conflicts = _chunk6HDMSFY7cjs.parsePorcelainV2.call(void 0, statusResult.stdout).filter((entry) => entry.type === "unmerged").map((entry) => entry.path);
3438
+ const conflicts = _chunkRWKMVYO5cjs.parsePorcelainV2.call(void 0, statusResult.stdout).filter((entry) => entry.type === "unmerged").map((entry) => entry.path);
3415
3439
  if (conflicts.length === 0) {
3416
3440
  this.runner.checkResult(this.context, args, result);
3417
3441
  }
@@ -3431,7 +3455,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3431
3455
  // High-level API - pull
3432
3456
  // ==========================================================================
3433
3457
  async pull(opts) {
3434
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "pull", opts);
3458
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "pull", opts);
3435
3459
  const args = ["pull"];
3436
3460
  if (_optionalChain([opts, 'optionalAccess', _511 => _511.onProgress]) || _optionalChain([opts, 'optionalAccess', _512 => _512.onLfsProgress])) {
3437
3461
  args.push("--progress");
@@ -3505,8 +3529,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3505
3529
  if (_optionalChain([opts, 'optionalAccess', _534 => _534.autostash])) {
3506
3530
  args.push("--autostash");
3507
3531
  }
3508
- if (_optionalChain([opts, 'optionalAccess', _535 => _535.strategy])) {
3509
- args.push(`--strategy=${opts.strategy}`);
3532
+ if (_optionalChain([opts, 'optionalAccess', _535 => _535.strategy]) !== void 0) {
3533
+ args.push(`--strategy=${checkedOptionValue("pull", "strategy", opts.strategy)}`);
3510
3534
  }
3511
3535
  if (_optionalChain([opts, 'optionalAccess', _536 => _536.strategyOption])) {
3512
3536
  const strategyOpts = Array.isArray(opts.strategyOption) ? opts.strategyOption : [opts.strategyOption];
@@ -3573,10 +3597,12 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3573
3597
  if (_optionalChain([opts, 'optionalAccess', _553 => _553.setUpstream])) {
3574
3598
  args.push("--set-upstream");
3575
3599
  }
3576
- if (_optionalChain([opts, 'optionalAccess', _554 => _554.remote])) {
3577
- args.push(checkedOperand("pull", "remote", opts.remote));
3600
+ if (_optionalChain([opts, 'optionalAccess', _554 => _554.remote]) !== void 0) {
3601
+ args.push(
3602
+ checkedOperand("pull", "remote", checkedOptionValue("pull", "remote", opts.remote))
3603
+ );
3578
3604
  }
3579
- if (_optionalChain([opts, 'optionalAccess', _555 => _555.branch])) {
3605
+ if (_optionalChain([opts, 'optionalAccess', _555 => _555.branch]) !== void 0) {
3580
3606
  args.push(checkedOperand("pull", "branch", opts.branch));
3581
3607
  }
3582
3608
  await this.runner.runOrThrow(this.context, args, {
@@ -3590,11 +3616,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3590
3616
  // High-level API - reset
3591
3617
  // ==========================================================================
3592
3618
  async reset(target, opts) {
3593
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "reset", opts);
3619
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "reset", opts);
3594
3620
  const args = ["reset"];
3595
3621
  if (_optionalChain([opts, 'optionalAccess', _559 => _559.mode]) !== void 0) {
3596
3622
  if (!RESET_MODES.includes(opts.mode)) {
3597
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
3623
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
3598
3624
  `reset: mode must be one of ${RESET_MODES.join(", ")} (got ${typeof opts.mode === "string" ? JSON.stringify(opts.mode) : typeof opts.mode})`
3599
3625
  );
3600
3626
  }
@@ -3612,11 +3638,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3612
3638
  if (_optionalChain([opts, 'optionalAccess', _563 => _563.intentToAdd])) {
3613
3639
  args.push("--intent-to-add");
3614
3640
  }
3615
- if (_optionalChain([opts, 'optionalAccess', _564 => _564.pathspecFromFile])) {
3641
+ if (_optionalChain([opts, 'optionalAccess', _564 => _564.pathspecFromFile]) !== void 0) {
3616
3642
  args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
3617
3643
  }
3618
- if (target) {
3619
- args.push(checkedOperand("reset", "target", target), "--");
3644
+ if (target !== void 0) {
3645
+ args.push(checkedRevision("reset", "target", target), "--");
3620
3646
  }
3621
3647
  await this.runner.runOrThrow(this.context, args, {
3622
3648
  signal: _optionalChain([opts, 'optionalAccess', _565 => _565.signal]),
@@ -3624,7 +3650,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3624
3650
  });
3625
3651
  }
3626
3652
  async rm(paths, opts) {
3627
- _chunk6HDMSFY7cjs.validatePathInput.call(void 0, "rm", paths, opts);
3653
+ _chunkRWKMVYO5cjs.validatePathInput.call(void 0, "rm", paths, opts);
3628
3654
  const args = ["rm"];
3629
3655
  if (_optionalChain([opts, 'optionalAccess', _566 => _566.force])) {
3630
3656
  args.push("--force");
@@ -3647,7 +3673,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3647
3673
  if (_optionalChain([opts, 'optionalAccess', _572 => _572.sparse])) {
3648
3674
  args.push("--sparse");
3649
3675
  }
3650
- if (_optionalChain([opts, 'optionalAccess', _573 => _573.pathspecFromFile])) {
3676
+ if (_optionalChain([opts, 'optionalAccess', _573 => _573.pathspecFromFile]) !== void 0) {
3651
3677
  args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
3652
3678
  }
3653
3679
  const pathList = Array.isArray(paths) ? paths : [paths];
@@ -3665,15 +3691,15 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3665
3691
  ["stash", "list", "-z", "--format=%gd%x00%H%x00%gs"],
3666
3692
  opts
3667
3693
  );
3668
- const fields = _chunk6HDMSFY7cjs.parseRecords.call(void 0, result.stdout);
3694
+ const fields = _chunkRWKMVYO5cjs.parseRecords.call(void 0, result.stdout);
3669
3695
  if (fields.length % 3 !== 0) {
3670
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid stash record");
3696
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid stash record");
3671
3697
  }
3672
3698
  const entries = [];
3673
3699
  for (let i = 0; i < fields.length; i += 3) {
3674
3700
  const index = _optionalChain([fields, 'access', _575 => _575[i], 'optionalAccess', _576 => _576.match, 'call', _577 => _577(/^stash@\{(\d+)\}$/), 'optionalAccess', _578 => _578[1]]);
3675
3701
  if (index === void 0 || !fields[i + 1]) {
3676
- throw new (0, _chunk6HDMSFY7cjs.GitError)("ParseError", "Invalid stash metadata");
3702
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("ParseError", "Invalid stash metadata");
3677
3703
  }
3678
3704
  const subject = fields[i + 2];
3679
3705
  const context = subject.match(/^(?:WIP on|On) (.*?): ([\s\S]*)$/);
@@ -3687,7 +3713,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3687
3713
  return entries;
3688
3714
  }
3689
3715
  async stashPush(opts) {
3690
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "stashPush", opts);
3716
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "stashPush", opts);
3691
3717
  const args = ["stash", "push"];
3692
3718
  if (_optionalChain([opts, 'optionalAccess', _580 => _580.message])) {
3693
3719
  args.push("-m", opts.message);
@@ -3707,11 +3733,11 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3707
3733
  if (_optionalChain([opts, 'optionalAccess', _585 => _585.all])) {
3708
3734
  args.push("--all");
3709
3735
  }
3710
- if (_optionalChain([opts, 'optionalAccess', _586 => _586.pathspecFromFile])) {
3736
+ if (_optionalChain([opts, 'optionalAccess', _586 => _586.pathspecFromFile]) !== void 0) {
3711
3737
  args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
3712
3738
  }
3713
3739
  if (_optionalChain([opts, 'optionalAccess', _587 => _587.paths]) && opts.paths.length > 0) {
3714
- _chunk6HDMSFY7cjs.validatePathInput.call(void 0, "stash.push", opts.paths, opts);
3740
+ _chunkRWKMVYO5cjs.validatePathInput.call(void 0, "stash.push", opts.paths, opts);
3715
3741
  args.push("--", ...opts.paths);
3716
3742
  }
3717
3743
  await this.runner.runOrThrow(this.context, args, {
@@ -3760,7 +3786,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3760
3786
  // High-level API - switch
3761
3787
  // ==========================================================================
3762
3788
  async switch(branch, opts) {
3763
- _chunk6HDMSFY7cjs.validateInput.call(void 0,
3789
+ _chunkRWKMVYO5cjs.validateInput.call(void 0,
3764
3790
  "switchTarget",
3765
3791
  {
3766
3792
  branch,
@@ -3771,7 +3797,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3771
3797
  },
3772
3798
  "switch"
3773
3799
  );
3774
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "switch", opts);
3800
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "switch", opts);
3775
3801
  const args = ["switch"];
3776
3802
  if (_optionalChain([opts, 'optionalAccess', _601 => _601.discard])) {
3777
3803
  args.push("--discard-changes");
@@ -3819,8 +3845,8 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3819
3845
  } else {
3820
3846
  args.push(target);
3821
3847
  }
3822
- if (_optionalChain([opts, 'optionalAccess', _618 => _618.startPoint])) {
3823
- args.push(checkedOperand("switch", "startPoint", opts.startPoint));
3848
+ if (_optionalChain([opts, 'optionalAccess', _618 => _618.startPoint]) !== void 0) {
3849
+ args.push(checkedRevision("switch", "startPoint", opts.startPoint));
3824
3850
  }
3825
3851
  await this.runner.runOrThrow(this.context, args, {
3826
3852
  signal: _optionalChain([opts, 'optionalAccess', _619 => _619.signal]),
@@ -3832,40 +3858,40 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3832
3858
  // ==========================================================================
3833
3859
  async tagList(opts) {
3834
3860
  const args = ["tag", "--list"];
3835
- if (_optionalChain([opts, 'optionalAccess', _620 => _620.sort])) {
3836
- args.push(`--sort=${opts.sort}`);
3861
+ if (_optionalChain([opts, 'optionalAccess', _620 => _620.sort]) !== void 0) {
3862
+ args.push(`--sort=${checkedOptionValue("tag.list", "sort", opts.sort)}`);
3837
3863
  }
3838
3864
  if (_optionalChain([opts, 'optionalAccess', _621 => _621.lines]) !== void 0) {
3839
3865
  args.push(`-n${opts.lines}`);
3840
3866
  }
3841
- if (_optionalChain([opts, 'optionalAccess', _622 => _622.contains])) {
3842
- args.push(`--contains=${opts.contains}`);
3867
+ if (_optionalChain([opts, 'optionalAccess', _622 => _622.contains]) !== void 0) {
3868
+ args.push(`--contains=${checkedOptionValue("tag.list", "contains", opts.contains)}`);
3843
3869
  }
3844
- if (_optionalChain([opts, 'optionalAccess', _623 => _623.noContains])) {
3845
- args.push(`--no-contains=${opts.noContains}`);
3870
+ if (_optionalChain([opts, 'optionalAccess', _623 => _623.noContains]) !== void 0) {
3871
+ args.push(`--no-contains=${checkedOptionValue("tag.list", "noContains", opts.noContains)}`);
3846
3872
  }
3847
- if (_optionalChain([opts, 'optionalAccess', _624 => _624.merged])) {
3848
- args.push(`--merged=${opts.merged}`);
3873
+ if (_optionalChain([opts, 'optionalAccess', _624 => _624.merged]) !== void 0) {
3874
+ args.push(`--merged=${checkedOptionValue("tag.list", "merged", opts.merged)}`);
3849
3875
  }
3850
- if (_optionalChain([opts, 'optionalAccess', _625 => _625.noMerged])) {
3851
- args.push(`--no-merged=${opts.noMerged}`);
3876
+ if (_optionalChain([opts, 'optionalAccess', _625 => _625.noMerged]) !== void 0) {
3877
+ args.push(`--no-merged=${checkedOptionValue("tag.list", "noMerged", opts.noMerged)}`);
3852
3878
  }
3853
- if (_optionalChain([opts, 'optionalAccess', _626 => _626.pointsAt])) {
3854
- args.push(`--points-at=${opts.pointsAt}`);
3879
+ if (_optionalChain([opts, 'optionalAccess', _626 => _626.pointsAt]) !== void 0) {
3880
+ args.push(`--points-at=${checkedOptionValue("tag.list", "pointsAt", opts.pointsAt)}`);
3855
3881
  }
3856
3882
  if (_optionalChain([opts, 'optionalAccess', _627 => _627.ignoreCase])) {
3857
3883
  args.push("--ignore-case");
3858
3884
  }
3859
- if (_optionalChain([opts, 'optionalAccess', _628 => _628.pattern])) {
3885
+ if (_optionalChain([opts, 'optionalAccess', _628 => _628.pattern]) !== void 0) {
3860
3886
  args.push(checkedOperand("tag.list", "pattern", opts.pattern));
3861
3887
  }
3862
3888
  const result = await this.runner.runOrThrow(this.context, args, {
3863
3889
  signal: _optionalChain([opts, 'optionalAccess', _629 => _629.signal])
3864
3890
  });
3865
- return _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout);
3891
+ return _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout);
3866
3892
  }
3867
3893
  async tagCreate(name, opts) {
3868
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "tagCreate", opts);
3894
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "tagCreate", opts);
3869
3895
  const args = ["tag"];
3870
3896
  if (_optionalChain([opts, 'optionalAccess', _630 => _630.sign])) {
3871
3897
  args.push("-s");
@@ -3894,15 +3920,15 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3894
3920
  if (_optionalChain([opts, 'optionalAccess', _635 => _635.cleanup])) {
3895
3921
  args.push(`--cleanup=${opts.cleanup}`);
3896
3922
  }
3897
- if (_optionalChain([opts, 'optionalAccess', _636 => _636.localUser])) {
3923
+ if (_optionalChain([opts, 'optionalAccess', _636 => _636.localUser]) !== void 0) {
3898
3924
  args.push(`--local-user=${opts.localUser}`);
3899
3925
  }
3900
3926
  if (_optionalChain([opts, 'optionalAccess', _637 => _637.createReflog])) {
3901
3927
  args.push("--create-reflog");
3902
3928
  }
3903
3929
  args.push(checkedOperand("tag.create", "name", name));
3904
- if (_optionalChain([opts, 'optionalAccess', _638 => _638.commit])) {
3905
- args.push(checkedOperand("tag.create", "commit", opts.commit));
3930
+ if (_optionalChain([opts, 'optionalAccess', _638 => _638.commit]) !== void 0) {
3931
+ args.push(checkedRevision("tag.create", "commit", opts.commit));
3906
3932
  }
3907
3933
  await this.runner.runOrThrow(this.context, args, {
3908
3934
  signal: _optionalChain([opts, 'optionalAccess', _639 => _639.signal])
@@ -3986,114 +4012,117 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
3986
4012
  async cherryPick(commits, opts) {
3987
4013
  const control = _optionalChain([opts, 'optionalAccess', _644 => _644.abort]) || _optionalChain([opts, 'optionalAccess', _645 => _645.continue]) || _optionalChain([opts, 'optionalAccess', _646 => _646.skip]);
3988
4014
  const commitList = control ? [] : checkedOperands("cherryPick", "commits", Array.isArray(commits) ? commits : [commits]);
4015
+ if (_optionalChain([opts, 'optionalAccess', _647 => _647.strategy]) !== void 0) {
4016
+ checkedOptionValue("cherryPick", "strategy", opts.strategy);
4017
+ }
3989
4018
  await this.runner.validateMainlineOptions(this.context, "cherryPick", opts, {
3990
- signal: _optionalChain([opts, 'optionalAccess', _647 => _647.signal])
4019
+ signal: _optionalChain([opts, 'optionalAccess', _648 => _648.signal])
3991
4020
  });
3992
4021
  const args = ["cherry-pick"];
3993
- if (_optionalChain([opts, 'optionalAccess', _648 => _648.abort])) {
4022
+ if (_optionalChain([opts, 'optionalAccess', _649 => _649.abort])) {
3994
4023
  args.push("--abort");
3995
4024
  }
3996
- if (_optionalChain([opts, 'optionalAccess', _649 => _649.continue])) {
4025
+ if (_optionalChain([opts, 'optionalAccess', _650 => _650.continue])) {
3997
4026
  args.push("--continue");
3998
4027
  }
3999
- if (_optionalChain([opts, 'optionalAccess', _650 => _650.skip])) {
4028
+ if (_optionalChain([opts, 'optionalAccess', _651 => _651.skip])) {
4000
4029
  args.push("--skip");
4001
4030
  }
4002
- if (_optionalChain([opts, 'optionalAccess', _651 => _651.edit])) {
4031
+ if (_optionalChain([opts, 'optionalAccess', _652 => _652.edit])) {
4003
4032
  args.push("-e");
4004
4033
  }
4005
- if (_optionalChain([opts, 'optionalAccess', _652 => _652.noCommit])) {
4034
+ if (_optionalChain([opts, 'optionalAccess', _653 => _653.noCommit])) {
4006
4035
  args.push("-n");
4007
4036
  }
4008
- if (_optionalChain([opts, 'optionalAccess', _653 => _653.signoff])) {
4037
+ if (_optionalChain([opts, 'optionalAccess', _654 => _654.signoff])) {
4009
4038
  args.push("-s");
4010
4039
  }
4011
- if (_optionalChain([opts, 'optionalAccess', _654 => _654.mainline]) !== void 0) {
4040
+ if (_optionalChain([opts, 'optionalAccess', _655 => _655.mainline]) !== void 0) {
4012
4041
  args.push("-m", opts.mainline.toString());
4013
4042
  }
4014
- if (_optionalChain([opts, 'optionalAccess', _655 => _655.strategy])) {
4043
+ if (_optionalChain([opts, 'optionalAccess', _656 => _656.strategy]) !== void 0) {
4015
4044
  args.push("--strategy", opts.strategy);
4016
4045
  }
4017
- if (_optionalChain([opts, 'optionalAccess', _656 => _656.cleanup])) {
4046
+ if (_optionalChain([opts, 'optionalAccess', _657 => _657.cleanup])) {
4018
4047
  args.push("--cleanup", opts.cleanup);
4019
4048
  }
4020
- if (_optionalChain([opts, 'optionalAccess', _657 => _657.rerereAutoupdate]) === true) {
4049
+ if (_optionalChain([opts, 'optionalAccess', _658 => _658.rerereAutoupdate]) === true) {
4021
4050
  args.push("--rerere-autoupdate");
4022
- } else if (_optionalChain([opts, 'optionalAccess', _658 => _658.rerereAutoupdate]) === false) {
4051
+ } else if (_optionalChain([opts, 'optionalAccess', _659 => _659.rerereAutoupdate]) === false) {
4023
4052
  args.push("--no-rerere-autoupdate");
4024
4053
  }
4025
- if (_optionalChain([opts, 'optionalAccess', _659 => _659.strategyOption])) {
4054
+ if (_optionalChain([opts, 'optionalAccess', _660 => _660.strategyOption])) {
4026
4055
  const strategyOptions = Array.isArray(opts.strategyOption) ? opts.strategyOption : [opts.strategyOption];
4027
4056
  for (const so of strategyOptions) {
4028
4057
  args.push("-X", so);
4029
4058
  }
4030
4059
  }
4031
- if (_optionalChain([opts, 'optionalAccess', _660 => _660.gpgSign]) === true) {
4060
+ if (_optionalChain([opts, 'optionalAccess', _661 => _661.gpgSign]) === true) {
4032
4061
  args.push("-S");
4033
- } else if (typeof _optionalChain([opts, 'optionalAccess', _661 => _661.gpgSign]) === "string") {
4062
+ } else if (typeof _optionalChain([opts, 'optionalAccess', _662 => _662.gpgSign]) === "string") {
4034
4063
  args.push(`-S${opts.gpgSign}`);
4035
4064
  }
4036
- if (_optionalChain([opts, 'optionalAccess', _662 => _662.appendCommitName])) {
4065
+ if (_optionalChain([opts, 'optionalAccess', _663 => _663.appendCommitName])) {
4037
4066
  args.push("-x");
4038
4067
  }
4039
- if (_optionalChain([opts, 'optionalAccess', _663 => _663.ff])) {
4068
+ if (_optionalChain([opts, 'optionalAccess', _664 => _664.ff])) {
4040
4069
  args.push("--ff");
4041
4070
  }
4042
- if (_optionalChain([opts, 'optionalAccess', _664 => _664.allowEmpty])) {
4071
+ if (_optionalChain([opts, 'optionalAccess', _665 => _665.allowEmpty])) {
4043
4072
  args.push("--allow-empty");
4044
4073
  }
4045
- if (_optionalChain([opts, 'optionalAccess', _665 => _665.allowEmptyMessage])) {
4074
+ if (_optionalChain([opts, 'optionalAccess', _666 => _666.allowEmptyMessage])) {
4046
4075
  args.push("--allow-empty-message");
4047
4076
  }
4048
- if (_optionalChain([opts, 'optionalAccess', _666 => _666.empty])) {
4077
+ if (_optionalChain([opts, 'optionalAccess', _667 => _667.empty])) {
4049
4078
  args.push("--empty", opts.empty);
4050
4079
  }
4051
4080
  if (!control) {
4052
4081
  args.push(...commitList);
4053
4082
  }
4054
4083
  await this.runner.runOrThrow(this.context, args, {
4055
- signal: _optionalChain([opts, 'optionalAccess', _667 => _667.signal])
4084
+ signal: _optionalChain([opts, 'optionalAccess', _668 => _668.signal])
4056
4085
  });
4057
4086
  }
4058
4087
  // ==========================================================================
4059
4088
  // Medium Priority - clean
4060
4089
  // ==========================================================================
4061
4090
  async clean(opts) {
4062
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "clean", opts);
4091
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "clean", opts);
4063
4092
  const args = ["clean"];
4064
- if (_optionalChain([opts, 'optionalAccess', _668 => _668.force])) {
4093
+ if (_optionalChain([opts, 'optionalAccess', _669 => _669.force])) {
4065
4094
  args.push("-f");
4066
4095
  }
4067
- if (_optionalChain([opts, 'optionalAccess', _669 => _669.directories])) {
4096
+ if (_optionalChain([opts, 'optionalAccess', _670 => _670.directories])) {
4068
4097
  args.push("-d");
4069
4098
  }
4070
- if (_optionalChain([opts, 'optionalAccess', _670 => _670.ignored])) {
4099
+ if (_optionalChain([opts, 'optionalAccess', _671 => _671.ignored])) {
4071
4100
  args.push("-x");
4072
- } else if (_optionalChain([opts, 'optionalAccess', _671 => _671.onlyIgnored])) {
4101
+ } else if (_optionalChain([opts, 'optionalAccess', _672 => _672.onlyIgnored])) {
4073
4102
  args.push("-X");
4074
4103
  }
4075
- if (_optionalChain([opts, 'optionalAccess', _672 => _672.dryRun])) {
4104
+ if (_optionalChain([opts, 'optionalAccess', _673 => _673.dryRun])) {
4076
4105
  args.push("-n");
4077
4106
  }
4078
- if (_optionalChain([opts, 'optionalAccess', _673 => _673.quiet])) {
4107
+ if (_optionalChain([opts, 'optionalAccess', _674 => _674.quiet])) {
4079
4108
  args.push("-q");
4080
4109
  }
4081
- if (_optionalChain([opts, 'optionalAccess', _674 => _674.exclude])) {
4110
+ if (_optionalChain([opts, 'optionalAccess', _675 => _675.exclude])) {
4082
4111
  const excludes = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
4083
4112
  for (const pattern of excludes) {
4084
4113
  args.push("-e", pattern);
4085
4114
  }
4086
4115
  }
4087
- if (_optionalChain([opts, 'optionalAccess', _675 => _675.paths]) && opts.paths.length > 0) {
4116
+ if (_optionalChain([opts, 'optionalAccess', _676 => _676.paths]) && opts.paths.length > 0) {
4088
4117
  args.push("--", ...opts.paths);
4089
4118
  }
4090
4119
  const result = await this.runner.runOrThrow(this.context, args, {
4091
- signal: _optionalChain([opts, 'optionalAccess', _676 => _676.signal])
4120
+ signal: _optionalChain([opts, 'optionalAccess', _677 => _677.signal])
4092
4121
  });
4093
4122
  const cleaned = [];
4094
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
4123
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
4095
4124
  const match = line.match(/^(?:Removing|Would remove) (.+)$/);
4096
- const matchedPath = _optionalChain([match, 'optionalAccess', _677 => _677[1]]);
4125
+ const matchedPath = _optionalChain([match, 'optionalAccess', _678 => _678[1]]);
4097
4126
  if (matchedPath !== void 0) {
4098
4127
  cleaned.push(matchedPath);
4099
4128
  }
@@ -4105,19 +4134,19 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4105
4134
  // ==========================================================================
4106
4135
  async mv(source, destination, opts) {
4107
4136
  const args = ["mv"];
4108
- if (_optionalChain([opts, 'optionalAccess', _678 => _678.force])) {
4137
+ if (_optionalChain([opts, 'optionalAccess', _679 => _679.force])) {
4109
4138
  args.push("-f");
4110
4139
  }
4111
- if (_optionalChain([opts, 'optionalAccess', _679 => _679.dryRun])) {
4140
+ if (_optionalChain([opts, 'optionalAccess', _680 => _680.dryRun])) {
4112
4141
  args.push("-n");
4113
4142
  }
4114
- if (_optionalChain([opts, 'optionalAccess', _680 => _680.verbose])) {
4143
+ if (_optionalChain([opts, 'optionalAccess', _681 => _681.verbose])) {
4115
4144
  args.push("-v");
4116
4145
  }
4117
- if (_optionalChain([opts, 'optionalAccess', _681 => _681.skipErrors])) {
4146
+ if (_optionalChain([opts, 'optionalAccess', _682 => _682.skipErrors])) {
4118
4147
  args.push("-k");
4119
4148
  }
4120
- if (_optionalChain([opts, 'optionalAccess', _682 => _682.sparse])) {
4149
+ if (_optionalChain([opts, 'optionalAccess', _683 => _683.sparse])) {
4121
4150
  args.push("--sparse");
4122
4151
  }
4123
4152
  args.push(
@@ -4125,206 +4154,206 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4125
4154
  checkedOperand("mv", "destination", destination)
4126
4155
  );
4127
4156
  await this.runner.runOrThrow(this.context, args, {
4128
- signal: _optionalChain([opts, 'optionalAccess', _683 => _683.signal])
4157
+ signal: _optionalChain([opts, 'optionalAccess', _684 => _684.signal])
4129
4158
  });
4130
4159
  }
4131
4160
  // ==========================================================================
4132
4161
  // Medium Priority - rebase
4133
4162
  // ==========================================================================
4134
4163
  async rebase(opts) {
4135
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "rebase", opts);
4164
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "rebase", opts);
4136
4165
  checkRebaseBackend(opts);
4137
4166
  const args = ["rebase"];
4138
- if (_optionalChain([opts, 'optionalAccess', _684 => _684.abort])) {
4167
+ if (_optionalChain([opts, 'optionalAccess', _685 => _685.abort])) {
4139
4168
  args.push("--abort");
4140
4169
  }
4141
- if (_optionalChain([opts, 'optionalAccess', _685 => _685.continue])) {
4170
+ if (_optionalChain([opts, 'optionalAccess', _686 => _686.continue])) {
4142
4171
  args.push("--continue");
4143
4172
  }
4144
- if (_optionalChain([opts, 'optionalAccess', _686 => _686.skip])) {
4173
+ if (_optionalChain([opts, 'optionalAccess', _687 => _687.skip])) {
4145
4174
  args.push("--skip");
4146
4175
  }
4147
- if (_optionalChain([opts, 'optionalAccess', _687 => _687.onto])) {
4148
- args.push("--onto", opts.onto);
4176
+ if (_optionalChain([opts, 'optionalAccess', _688 => _688.onto]) !== void 0) {
4177
+ args.push("--onto", checkedOptionValue("rebase", "onto", opts.onto));
4149
4178
  }
4150
- if (_optionalChain([opts, 'optionalAccess', _688 => _688.rebaseMerges])) {
4179
+ if (_optionalChain([opts, 'optionalAccess', _689 => _689.rebaseMerges])) {
4151
4180
  args.push("--rebase-merges");
4152
4181
  }
4153
- if (_optionalChain([opts, 'optionalAccess', _689 => _689.noVerify])) {
4182
+ if (_optionalChain([opts, 'optionalAccess', _690 => _690.noVerify])) {
4154
4183
  args.push("--no-verify");
4155
4184
  }
4156
- if (_optionalChain([opts, 'optionalAccess', _690 => _690.keepBase])) {
4185
+ if (_optionalChain([opts, 'optionalAccess', _691 => _691.keepBase])) {
4157
4186
  args.push("--keep-base");
4158
4187
  }
4159
- if (_optionalChain([opts, 'optionalAccess', _691 => _691.quiet])) {
4188
+ if (_optionalChain([opts, 'optionalAccess', _692 => _692.quiet])) {
4160
4189
  args.push("--quiet");
4161
4190
  }
4162
- if (_optionalChain([opts, 'optionalAccess', _692 => _692.verbose])) {
4191
+ if (_optionalChain([opts, 'optionalAccess', _693 => _693.verbose])) {
4163
4192
  args.push("--verbose");
4164
4193
  }
4165
- if (_optionalChain([opts, 'optionalAccess', _693 => _693.signoff])) {
4194
+ if (_optionalChain([opts, 'optionalAccess', _694 => _694.signoff])) {
4166
4195
  args.push("--signoff");
4167
4196
  }
4168
- if (_optionalChain([opts, 'optionalAccess', _694 => _694.committerDateIsAuthorDate])) {
4197
+ if (_optionalChain([opts, 'optionalAccess', _695 => _695.committerDateIsAuthorDate])) {
4169
4198
  args.push("--committer-date-is-author-date");
4170
4199
  }
4171
- if (_optionalChain([opts, 'optionalAccess', _695 => _695.resetAuthorDate])) {
4200
+ if (_optionalChain([opts, 'optionalAccess', _696 => _696.resetAuthorDate])) {
4172
4201
  args.push("--reset-author-date");
4173
4202
  }
4174
- if (_optionalChain([opts, 'optionalAccess', _696 => _696.ignoreWhitespace])) {
4203
+ if (_optionalChain([opts, 'optionalAccess', _697 => _697.ignoreWhitespace])) {
4175
4204
  args.push("--ignore-whitespace");
4176
4205
  }
4177
- if (_optionalChain([opts, 'optionalAccess', _697 => _697.whitespace])) {
4206
+ if (_optionalChain([opts, 'optionalAccess', _698 => _698.whitespace])) {
4178
4207
  args.push("--whitespace", opts.whitespace);
4179
4208
  }
4180
- if (_optionalChain([opts, 'optionalAccess', _698 => _698.forceRebase])) {
4209
+ if (_optionalChain([opts, 'optionalAccess', _699 => _699.forceRebase])) {
4181
4210
  args.push("--force-rebase");
4182
4211
  }
4183
- if (_optionalChain([opts, 'optionalAccess', _699 => _699.noFf])) {
4212
+ if (_optionalChain([opts, 'optionalAccess', _700 => _700.noFf])) {
4184
4213
  args.push("--no-ff");
4185
4214
  }
4186
- if (_optionalChain([opts, 'optionalAccess', _700 => _700.apply])) {
4215
+ if (_optionalChain([opts, 'optionalAccess', _701 => _701.apply])) {
4187
4216
  args.push("--apply");
4188
4217
  }
4189
- if (_optionalChain([opts, 'optionalAccess', _701 => _701.rerereAutoupdate]) === true) {
4218
+ if (_optionalChain([opts, 'optionalAccess', _702 => _702.rerereAutoupdate]) === true) {
4190
4219
  args.push("--rerere-autoupdate");
4191
- } else if (_optionalChain([opts, 'optionalAccess', _702 => _702.rerereAutoupdate]) === false) {
4220
+ } else if (_optionalChain([opts, 'optionalAccess', _703 => _703.rerereAutoupdate]) === false) {
4192
4221
  args.push("--no-rerere-autoupdate");
4193
4222
  }
4194
- if (_optionalChain([opts, 'optionalAccess', _703 => _703.empty])) {
4223
+ if (_optionalChain([opts, 'optionalAccess', _704 => _704.empty])) {
4195
4224
  args.push("--empty", opts.empty);
4196
4225
  }
4197
- if (_optionalChain([opts, 'optionalAccess', _704 => _704.autosquash]) === true) {
4226
+ if (_optionalChain([opts, 'optionalAccess', _705 => _705.autosquash]) === true) {
4198
4227
  args.push("--autosquash");
4199
- } else if (_optionalChain([opts, 'optionalAccess', _705 => _705.autosquash]) === false) {
4228
+ } else if (_optionalChain([opts, 'optionalAccess', _706 => _706.autosquash]) === false) {
4200
4229
  args.push("--no-autosquash");
4201
4230
  }
4202
- if (_optionalChain([opts, 'optionalAccess', _706 => _706.updateRefs]) === true) {
4231
+ if (_optionalChain([opts, 'optionalAccess', _707 => _707.updateRefs]) === true) {
4203
4232
  args.push("--update-refs");
4204
- } else if (_optionalChain([opts, 'optionalAccess', _707 => _707.updateRefs]) === false) {
4233
+ } else if (_optionalChain([opts, 'optionalAccess', _708 => _708.updateRefs]) === false) {
4205
4234
  args.push("--no-update-refs");
4206
4235
  }
4207
- if (_optionalChain([opts, 'optionalAccess', _708 => _708.gpgSign]) === true) {
4236
+ if (_optionalChain([opts, 'optionalAccess', _709 => _709.gpgSign]) === true) {
4208
4237
  args.push("-S");
4209
- } else if (typeof _optionalChain([opts, 'optionalAccess', _709 => _709.gpgSign]) === "string") {
4238
+ } else if (typeof _optionalChain([opts, 'optionalAccess', _710 => _710.gpgSign]) === "string") {
4210
4239
  args.push(`-S${opts.gpgSign}`);
4211
4240
  }
4212
- if (_optionalChain([opts, 'optionalAccess', _710 => _710.autostash]) === true) {
4241
+ if (_optionalChain([opts, 'optionalAccess', _711 => _711.autostash]) === true) {
4213
4242
  args.push("--autostash");
4214
- } else if (_optionalChain([opts, 'optionalAccess', _711 => _711.autostash]) === false) {
4243
+ } else if (_optionalChain([opts, 'optionalAccess', _712 => _712.autostash]) === false) {
4215
4244
  args.push("--no-autostash");
4216
4245
  }
4217
- if (_optionalChain([opts, 'optionalAccess', _712 => _712.exec]) !== void 0) {
4246
+ if (_optionalChain([opts, 'optionalAccess', _713 => _713.exec]) !== void 0) {
4218
4247
  const execs = Array.isArray(opts.exec) ? opts.exec : [opts.exec];
4219
4248
  for (const cmd of execs) {
4220
4249
  if (typeof cmd !== "string" || /^[ \t\r\f\v]*$/.test(cmd) || cmd.includes("\n")) {
4221
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
4250
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
4222
4251
  "rebase: exec must be a nonempty command without newlines [rebase.exec-command]"
4223
4252
  );
4224
4253
  }
4225
4254
  args.push("--exec", cmd);
4226
4255
  }
4227
4256
  }
4228
- if (_optionalChain([opts, 'optionalAccess', _713 => _713.forkPoint]) === true) {
4257
+ if (_optionalChain([opts, 'optionalAccess', _714 => _714.forkPoint]) === true) {
4229
4258
  args.push("--fork-point");
4230
- } else if (_optionalChain([opts, 'optionalAccess', _714 => _714.forkPoint]) === false) {
4259
+ } else if (_optionalChain([opts, 'optionalAccess', _715 => _715.forkPoint]) === false) {
4231
4260
  args.push("--no-fork-point");
4232
4261
  }
4233
- if (_optionalChain([opts, 'optionalAccess', _715 => _715.strategy])) {
4234
- args.push("--strategy", opts.strategy);
4262
+ if (_optionalChain([opts, 'optionalAccess', _716 => _716.strategy]) !== void 0) {
4263
+ args.push("--strategy", checkedOptionValue("rebase", "strategy", opts.strategy));
4235
4264
  }
4236
- if (_optionalChain([opts, 'optionalAccess', _716 => _716.strategyOption])) {
4265
+ if (_optionalChain([opts, 'optionalAccess', _717 => _717.strategyOption])) {
4237
4266
  const strategyOptions = Array.isArray(opts.strategyOption) ? opts.strategyOption : [opts.strategyOption];
4238
4267
  for (const so of strategyOptions) {
4239
4268
  args.push("-X", so);
4240
4269
  }
4241
4270
  }
4242
- if (_optionalChain([opts, 'optionalAccess', _717 => _717.root])) {
4271
+ if (_optionalChain([opts, 'optionalAccess', _718 => _718.root])) {
4243
4272
  args.push("--root");
4244
4273
  }
4245
- if (_optionalChain([opts, 'optionalAccess', _718 => _718.rescheduleFailedExec]) === true) {
4274
+ if (_optionalChain([opts, 'optionalAccess', _719 => _719.rescheduleFailedExec]) === true) {
4246
4275
  args.push("--reschedule-failed-exec");
4247
- } else if (_optionalChain([opts, 'optionalAccess', _719 => _719.rescheduleFailedExec]) === false) {
4276
+ } else if (_optionalChain([opts, 'optionalAccess', _720 => _720.rescheduleFailedExec]) === false) {
4248
4277
  args.push("--no-reschedule-failed-exec");
4249
4278
  }
4250
- if (_optionalChain([opts, 'optionalAccess', _720 => _720.reapplyCherryPicks]) === true) {
4279
+ if (_optionalChain([opts, 'optionalAccess', _721 => _721.reapplyCherryPicks]) === true) {
4251
4280
  args.push("--reapply-cherry-picks");
4252
- } else if (_optionalChain([opts, 'optionalAccess', _721 => _721.reapplyCherryPicks]) === false) {
4281
+ } else if (_optionalChain([opts, 'optionalAccess', _722 => _722.reapplyCherryPicks]) === false) {
4253
4282
  args.push("--no-reapply-cherry-picks");
4254
4283
  }
4255
- if (_optionalChain([opts, 'optionalAccess', _722 => _722.upstream])) {
4256
- args.push(checkedOperand("rebase", "upstream", opts.upstream));
4284
+ if (_optionalChain([opts, 'optionalAccess', _723 => _723.upstream]) !== void 0) {
4285
+ args.push(checkedRevision("rebase", "upstream", opts.upstream));
4257
4286
  }
4258
4287
  await this.runner.runOrThrow(this.context, args, {
4259
- signal: _optionalChain([opts, 'optionalAccess', _723 => _723.signal]),
4288
+ signal: _optionalChain([opts, 'optionalAccess', _724 => _724.signal]),
4260
4289
  env: this.lfsModeEnv()
4261
4290
  });
4262
4291
  }
4263
4292
  async restore(paths, opts) {
4264
- _chunk6HDMSFY7cjs.validatePathInput.call(void 0, "restore", paths, opts);
4265
- _chunk6HDMSFY7cjs.validateInput.call(void 0,
4293
+ _chunkRWKMVYO5cjs.validatePathInput.call(void 0, "restore", paths, opts);
4294
+ _chunkRWKMVYO5cjs.validateInput.call(void 0,
4266
4295
  "restorePaths",
4267
4296
  {
4268
4297
  paths: Array.isArray(paths) ? paths : [paths],
4269
- pathspecFromFile: _optionalChain([opts, 'optionalAccess', _724 => _724.pathspecFromFile]),
4270
- source: _optionalChain([opts, 'optionalAccess', _725 => _725.source])
4298
+ pathspecFromFile: _optionalChain([opts, 'optionalAccess', _725 => _725.pathspecFromFile]),
4299
+ source: _optionalChain([opts, 'optionalAccess', _726 => _726.source])
4271
4300
  },
4272
4301
  "restore"
4273
4302
  );
4274
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "restore", opts);
4303
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "restore", opts);
4275
4304
  const args = ["restore"];
4276
- if (_optionalChain([opts, 'optionalAccess', _726 => _726.staged])) {
4305
+ if (_optionalChain([opts, 'optionalAccess', _727 => _727.staged])) {
4277
4306
  args.push("--staged");
4278
4307
  }
4279
- if (_optionalChain([opts, 'optionalAccess', _727 => _727.worktree])) {
4308
+ if (_optionalChain([opts, 'optionalAccess', _728 => _728.worktree])) {
4280
4309
  args.push("--worktree");
4281
4310
  }
4282
- if (_optionalChain([opts, 'optionalAccess', _728 => _728.source])) {
4283
- args.push("--source", opts.source);
4311
+ if (_optionalChain([opts, 'optionalAccess', _729 => _729.source]) !== void 0) {
4312
+ args.push("--source", checkedOptionValue("restore", "source", opts.source));
4284
4313
  }
4285
- if (_optionalChain([opts, 'optionalAccess', _729 => _729.ours])) {
4314
+ if (_optionalChain([opts, 'optionalAccess', _730 => _730.ours])) {
4286
4315
  args.push("--ours");
4287
4316
  }
4288
- if (_optionalChain([opts, 'optionalAccess', _730 => _730.theirs])) {
4317
+ if (_optionalChain([opts, 'optionalAccess', _731 => _731.theirs])) {
4289
4318
  args.push("--theirs");
4290
4319
  }
4291
- if (_optionalChain([opts, 'optionalAccess', _731 => _731.ignoreUnmerged])) {
4320
+ if (_optionalChain([opts, 'optionalAccess', _732 => _732.ignoreUnmerged])) {
4292
4321
  args.push("--ignore-unmerged");
4293
4322
  }
4294
- if (_optionalChain([opts, 'optionalAccess', _732 => _732.overlay]) === true) {
4323
+ if (_optionalChain([opts, 'optionalAccess', _733 => _733.overlay]) === true) {
4295
4324
  args.push("--overlay");
4296
- } else if (_optionalChain([opts, 'optionalAccess', _733 => _733.overlay]) === false) {
4325
+ } else if (_optionalChain([opts, 'optionalAccess', _734 => _734.overlay]) === false) {
4297
4326
  args.push("--no-overlay");
4298
4327
  }
4299
- if (_optionalChain([opts, 'optionalAccess', _734 => _734.quiet])) {
4328
+ if (_optionalChain([opts, 'optionalAccess', _735 => _735.quiet])) {
4300
4329
  args.push("--quiet");
4301
4330
  }
4302
- if (_optionalChain([opts, 'optionalAccess', _735 => _735.recurseSubmodules]) === true) {
4331
+ if (_optionalChain([opts, 'optionalAccess', _736 => _736.recurseSubmodules]) === true) {
4303
4332
  args.push("--recurse-submodules");
4304
- } else if (_optionalChain([opts, 'optionalAccess', _736 => _736.recurseSubmodules]) === false) {
4333
+ } else if (_optionalChain([opts, 'optionalAccess', _737 => _737.recurseSubmodules]) === false) {
4305
4334
  args.push("--no-recurse-submodules");
4306
4335
  }
4307
- if (_optionalChain([opts, 'optionalAccess', _737 => _737.progress]) === true) {
4336
+ if (_optionalChain([opts, 'optionalAccess', _738 => _738.progress]) === true) {
4308
4337
  args.push("--progress");
4309
- } else if (_optionalChain([opts, 'optionalAccess', _738 => _738.progress]) === false) {
4338
+ } else if (_optionalChain([opts, 'optionalAccess', _739 => _739.progress]) === false) {
4310
4339
  args.push("--no-progress");
4311
4340
  }
4312
- if (_optionalChain([opts, 'optionalAccess', _739 => _739.merge])) {
4341
+ if (_optionalChain([opts, 'optionalAccess', _740 => _740.merge])) {
4313
4342
  args.push("--merge");
4314
4343
  }
4315
- if (_optionalChain([opts, 'optionalAccess', _740 => _740.conflict])) {
4344
+ if (_optionalChain([opts, 'optionalAccess', _741 => _741.conflict])) {
4316
4345
  args.push("--conflict", opts.conflict);
4317
4346
  }
4318
- if (_optionalChain([opts, 'optionalAccess', _741 => _741.ignoreSkipWorktreeBits])) {
4347
+ if (_optionalChain([opts, 'optionalAccess', _742 => _742.ignoreSkipWorktreeBits])) {
4319
4348
  args.push("--ignore-skip-worktree-bits");
4320
4349
  }
4321
- if (_optionalChain([opts, 'optionalAccess', _742 => _742.pathspecFromFile])) {
4350
+ if (_optionalChain([opts, 'optionalAccess', _743 => _743.pathspecFromFile]) !== void 0) {
4322
4351
  args.push("--pathspec-from-file", opts.pathspecFromFile);
4323
4352
  }
4324
4353
  const pathList = Array.isArray(paths) ? paths : [paths];
4325
4354
  args.push("--", ...pathList);
4326
4355
  await this.runner.runOrThrow(this.context, args, {
4327
- signal: _optionalChain([opts, 'optionalAccess', _743 => _743.signal]),
4356
+ signal: _optionalChain([opts, 'optionalAccess', _744 => _744.signal]),
4328
4357
  env: this.lfsModeEnv()
4329
4358
  });
4330
4359
  }
@@ -4332,122 +4361,125 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4332
4361
  // Medium Priority - revert
4333
4362
  // ==========================================================================
4334
4363
  async revert(commits, opts) {
4335
- const control = _optionalChain([opts, 'optionalAccess', _744 => _744.abort]) || _optionalChain([opts, 'optionalAccess', _745 => _745.continue]) || _optionalChain([opts, 'optionalAccess', _746 => _746.skip]);
4364
+ const control = _optionalChain([opts, 'optionalAccess', _745 => _745.abort]) || _optionalChain([opts, 'optionalAccess', _746 => _746.continue]) || _optionalChain([opts, 'optionalAccess', _747 => _747.skip]);
4336
4365
  const commitList = control ? [] : checkedOperands("revert", "commits", Array.isArray(commits) ? commits : [commits]);
4366
+ if (_optionalChain([opts, 'optionalAccess', _748 => _748.strategy]) !== void 0) {
4367
+ checkedOptionValue("revert", "strategy", opts.strategy);
4368
+ }
4337
4369
  await this.runner.validateMainlineOptions(this.context, "revert", opts, {
4338
- signal: _optionalChain([opts, 'optionalAccess', _747 => _747.signal])
4370
+ signal: _optionalChain([opts, 'optionalAccess', _749 => _749.signal])
4339
4371
  });
4340
4372
  const args = ["revert"];
4341
- if (_optionalChain([opts, 'optionalAccess', _748 => _748.abort])) {
4373
+ if (_optionalChain([opts, 'optionalAccess', _750 => _750.abort])) {
4342
4374
  args.push("--abort");
4343
4375
  }
4344
- if (_optionalChain([opts, 'optionalAccess', _749 => _749.continue])) {
4376
+ if (_optionalChain([opts, 'optionalAccess', _751 => _751.continue])) {
4345
4377
  args.push("--continue");
4346
4378
  }
4347
- if (_optionalChain([opts, 'optionalAccess', _750 => _750.skip])) {
4379
+ if (_optionalChain([opts, 'optionalAccess', _752 => _752.skip])) {
4348
4380
  args.push("--skip");
4349
4381
  }
4350
- if (_optionalChain([opts, 'optionalAccess', _751 => _751.edit])) {
4382
+ if (_optionalChain([opts, 'optionalAccess', _753 => _753.edit])) {
4351
4383
  args.push("-e");
4352
4384
  }
4353
- if (_optionalChain([opts, 'optionalAccess', _752 => _752.noCommit])) {
4385
+ if (_optionalChain([opts, 'optionalAccess', _754 => _754.noCommit])) {
4354
4386
  args.push("-n");
4355
4387
  }
4356
- if (_optionalChain([opts, 'optionalAccess', _753 => _753.mainline]) !== void 0) {
4388
+ if (_optionalChain([opts, 'optionalAccess', _755 => _755.mainline]) !== void 0) {
4357
4389
  args.push("-m", opts.mainline.toString());
4358
4390
  }
4359
- if (_optionalChain([opts, 'optionalAccess', _754 => _754.cleanup])) {
4391
+ if (_optionalChain([opts, 'optionalAccess', _756 => _756.cleanup])) {
4360
4392
  args.push("--cleanup", opts.cleanup);
4361
4393
  }
4362
- if (_optionalChain([opts, 'optionalAccess', _755 => _755.signoff])) {
4394
+ if (_optionalChain([opts, 'optionalAccess', _757 => _757.signoff])) {
4363
4395
  args.push("--signoff");
4364
4396
  }
4365
- if (_optionalChain([opts, 'optionalAccess', _756 => _756.rerereAutoupdate]) === true) {
4397
+ if (_optionalChain([opts, 'optionalAccess', _758 => _758.rerereAutoupdate]) === true) {
4366
4398
  args.push("--rerere-autoupdate");
4367
- } else if (_optionalChain([opts, 'optionalAccess', _757 => _757.rerereAutoupdate]) === false) {
4399
+ } else if (_optionalChain([opts, 'optionalAccess', _759 => _759.rerereAutoupdate]) === false) {
4368
4400
  args.push("--no-rerere-autoupdate");
4369
4401
  }
4370
- if (_optionalChain([opts, 'optionalAccess', _758 => _758.strategy])) {
4402
+ if (_optionalChain([opts, 'optionalAccess', _760 => _760.strategy]) !== void 0) {
4371
4403
  args.push("--strategy", opts.strategy);
4372
4404
  }
4373
- if (_optionalChain([opts, 'optionalAccess', _759 => _759.strategyOption])) {
4405
+ if (_optionalChain([opts, 'optionalAccess', _761 => _761.strategyOption])) {
4374
4406
  const strategyOptions = Array.isArray(opts.strategyOption) ? opts.strategyOption : [opts.strategyOption];
4375
4407
  for (const so of strategyOptions) {
4376
4408
  args.push("-X", so);
4377
4409
  }
4378
4410
  }
4379
- if (_optionalChain([opts, 'optionalAccess', _760 => _760.gpgSign]) === true) {
4411
+ if (_optionalChain([opts, 'optionalAccess', _762 => _762.gpgSign]) === true) {
4380
4412
  args.push("-S");
4381
- } else if (typeof _optionalChain([opts, 'optionalAccess', _761 => _761.gpgSign]) === "string") {
4413
+ } else if (typeof _optionalChain([opts, 'optionalAccess', _763 => _763.gpgSign]) === "string") {
4382
4414
  args.push(`-S${opts.gpgSign}`);
4383
4415
  }
4384
- if (_optionalChain([opts, 'optionalAccess', _762 => _762.reference])) {
4416
+ if (_optionalChain([opts, 'optionalAccess', _764 => _764.reference])) {
4385
4417
  args.push("--reference");
4386
4418
  }
4387
4419
  if (!control) {
4388
4420
  args.push(...commitList);
4389
4421
  }
4390
4422
  await this.runner.runOrThrow(this.context, args, {
4391
- signal: _optionalChain([opts, 'optionalAccess', _763 => _763.signal])
4423
+ signal: _optionalChain([opts, 'optionalAccess', _765 => _765.signal])
4392
4424
  });
4393
4425
  }
4394
4426
  // ==========================================================================
4395
4427
  // Medium Priority - show
4396
4428
  // ==========================================================================
4397
4429
  async show(object, opts) {
4398
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "show", opts);
4430
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "show", opts);
4399
4431
  const args = ["show"];
4400
- if (_optionalChain([opts, 'optionalAccess', _764 => _764.stat])) {
4432
+ if (_optionalChain([opts, 'optionalAccess', _766 => _766.stat])) {
4401
4433
  args.push("--stat");
4402
4434
  }
4403
- if (_optionalChain([opts, 'optionalAccess', _765 => _765.nameOnly])) {
4435
+ if (_optionalChain([opts, 'optionalAccess', _767 => _767.nameOnly])) {
4404
4436
  args.push("--name-only");
4405
4437
  }
4406
- if (_optionalChain([opts, 'optionalAccess', _766 => _766.nameStatus])) {
4438
+ if (_optionalChain([opts, 'optionalAccess', _768 => _768.nameStatus])) {
4407
4439
  args.push("--name-status");
4408
4440
  }
4409
- if (_optionalChain([opts, 'optionalAccess', _767 => _767.format])) {
4441
+ if (_optionalChain([opts, 'optionalAccess', _769 => _769.format]) !== void 0) {
4410
4442
  args.push(`--format=${opts.format}`);
4411
4443
  }
4412
- if (_optionalChain([opts, 'optionalAccess', _768 => _768.quiet])) {
4444
+ if (_optionalChain([opts, 'optionalAccess', _770 => _770.quiet])) {
4413
4445
  args.push("--quiet");
4414
4446
  }
4415
- if (_optionalChain([opts, 'optionalAccess', _769 => _769.source])) {
4447
+ if (_optionalChain([opts, 'optionalAccess', _771 => _771.source])) {
4416
4448
  args.push("--source");
4417
4449
  }
4418
- if (_optionalChain([opts, 'optionalAccess', _770 => _770.useMailmap])) {
4450
+ if (_optionalChain([opts, 'optionalAccess', _772 => _772.useMailmap])) {
4419
4451
  args.push("--use-mailmap");
4420
4452
  }
4421
- if (_optionalChain([opts, 'optionalAccess', _771 => _771.decorateRefs])) {
4453
+ if (_optionalChain([opts, 'optionalAccess', _773 => _773.decorateRefs]) !== void 0) {
4422
4454
  args.push("--decorate-refs", opts.decorateRefs);
4423
4455
  }
4424
- if (_optionalChain([opts, 'optionalAccess', _772 => _772.decorateRefsExclude])) {
4456
+ if (_optionalChain([opts, 'optionalAccess', _774 => _774.decorateRefsExclude]) !== void 0) {
4425
4457
  args.push("--decorate-refs-exclude", opts.decorateRefsExclude);
4426
4458
  }
4427
- if (_optionalChain([opts, 'optionalAccess', _773 => _773.decorate])) {
4459
+ if (_optionalChain([opts, 'optionalAccess', _775 => _775.decorate])) {
4428
4460
  args.push(`--decorate=${opts.decorate}`);
4429
4461
  }
4430
4462
  args.push(checkedOperand("show", "object", object));
4431
4463
  const result = await this.runner.runOrThrow(this.context, args, {
4432
- signal: _optionalChain([opts, 'optionalAccess', _774 => _774.signal])
4464
+ signal: _optionalChain([opts, 'optionalAccess', _776 => _776.signal])
4433
4465
  });
4434
4466
  return result.stdout;
4435
4467
  }
4436
4468
  async revParse(refOrOpts, opts) {
4437
4469
  const args = ["rev-parse"];
4438
4470
  if (typeof refOrOpts === "string") {
4439
- _chunk6HDMSFY7cjs.validateRevParseRefOpts.call(void 0, opts);
4440
- if (_optionalChain([opts, 'optionalAccess', _775 => _775.verify])) {
4471
+ _chunkRWKMVYO5cjs.validateRevParseRefOpts.call(void 0, opts);
4472
+ if (_optionalChain([opts, 'optionalAccess', _777 => _777.verify])) {
4441
4473
  args.push("--verify");
4442
4474
  }
4443
- if (_optionalChain([opts, 'optionalAccess', _776 => _776.short]) !== void 0) {
4475
+ if (_optionalChain([opts, 'optionalAccess', _778 => _778.short]) !== void 0) {
4444
4476
  if (typeof opts.short === "number") {
4445
4477
  args.push(`--short=${opts.short}`);
4446
4478
  } else if (opts.short) {
4447
4479
  args.push("--short");
4448
4480
  }
4449
4481
  }
4450
- if (_optionalChain([opts, 'optionalAccess', _777 => _777.abbrevRef]) !== void 0) {
4482
+ if (_optionalChain([opts, 'optionalAccess', _779 => _779.abbrevRef]) !== void 0) {
4451
4483
  if (opts.abbrevRef === "strict") {
4452
4484
  args.push("--abbrev-ref=strict");
4453
4485
  } else if (opts.abbrevRef === "loose") {
@@ -4456,24 +4488,24 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4456
4488
  args.push("--abbrev-ref");
4457
4489
  }
4458
4490
  }
4459
- if (_optionalChain([opts, 'optionalAccess', _778 => _778.symbolic])) {
4491
+ if (_optionalChain([opts, 'optionalAccess', _780 => _780.symbolic])) {
4460
4492
  args.push("--symbolic");
4461
4493
  }
4462
- if (_optionalChain([opts, 'optionalAccess', _779 => _779.symbolicFullName])) {
4494
+ if (_optionalChain([opts, 'optionalAccess', _781 => _781.symbolicFullName])) {
4463
4495
  args.push("--symbolic-full-name");
4464
4496
  }
4465
- if (_optionalChain([opts, 'optionalAccess', _780 => _780.quiet])) {
4497
+ if (_optionalChain([opts, 'optionalAccess', _782 => _782.quiet])) {
4466
4498
  args.push("--quiet");
4467
4499
  }
4468
4500
  args.push(checkedOperand("revParse", "ref", refOrOpts));
4469
- const result2 = await this.runner.run(this.context, args, { signal: _optionalChain([opts, 'optionalAccess', _781 => _781.signal]) });
4470
- if (_optionalChain([opts, 'optionalAccess', _782 => _782.quiet]) && result2.exitCode === 1 && !result2.aborted) {
4501
+ const result2 = await this.runner.run(this.context, args, { signal: _optionalChain([opts, 'optionalAccess', _783 => _783.signal]) });
4502
+ if (_optionalChain([opts, 'optionalAccess', _784 => _784.quiet]) && result2.exitCode === 1 && !result2.aborted) {
4471
4503
  return void 0;
4472
4504
  }
4473
4505
  this.runner.checkResult(this.context, args, result2);
4474
4506
  return result2.stdout.trim();
4475
4507
  }
4476
- _chunk6HDMSFY7cjs.validateRevParseQuery.call(void 0, refOrOpts);
4508
+ _chunkRWKMVYO5cjs.validateRevParseQuery.call(void 0, refOrOpts);
4477
4509
  if ("pathFormat" in refOrOpts && refOrOpts.pathFormat) {
4478
4510
  args.push(`--path-format=${refOrOpts.pathFormat}`);
4479
4511
  }
@@ -4588,13 +4620,13 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4588
4620
  */
4589
4621
  async revListCount(ref, opts) {
4590
4622
  const args = ["rev-list", "--count"];
4591
- if (ref) {
4592
- args.push(checkedOperand("revListCount", "ref", ref));
4623
+ if (ref !== void 0) {
4624
+ args.push(checkedRevision("revListCount", "ref", ref));
4593
4625
  } else {
4594
4626
  args.push("HEAD");
4595
4627
  }
4596
4628
  const result = await this.runner.runOrThrow(this.context, args, {
4597
- signal: _optionalChain([opts, 'optionalAccess', _783 => _783.signal])
4629
+ signal: _optionalChain([opts, 'optionalAccess', _785 => _785.signal])
4598
4630
  });
4599
4631
  return Number.parseInt(result.stdout.trim(), 10);
4600
4632
  }
@@ -4611,7 +4643,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4611
4643
  checkedOperand("symbolicRef", "ref", newRef)
4612
4644
  ],
4613
4645
  {
4614
- signal: _optionalChain([opts, 'optionalAccess', _784 => _784.signal])
4646
+ signal: _optionalChain([opts, 'optionalAccess', _786 => _786.signal])
4615
4647
  }
4616
4648
  );
4617
4649
  return void 0;
@@ -4620,7 +4652,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4620
4652
  this.context,
4621
4653
  ["symbolic-ref", checkedOperand("symbolicRef", "name", name)],
4622
4654
  {
4623
- signal: _optionalChain([opts, 'optionalAccess', _785 => _785.signal])
4655
+ signal: _optionalChain([opts, 'optionalAccess', _787 => _787.signal])
4624
4656
  }
4625
4657
  );
4626
4658
  return result.stdout.trim();
@@ -4630,13 +4662,13 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4630
4662
  // ==========================================================================
4631
4663
  async submoduleList(opts) {
4632
4664
  const result = await this.runner.run(this.context, ["submodule", "status"], {
4633
- signal: _optionalChain([opts, 'optionalAccess', _786 => _786.signal])
4665
+ signal: _optionalChain([opts, 'optionalAccess', _788 => _788.signal])
4634
4666
  });
4635
4667
  if (result.exitCode !== 0) {
4636
4668
  return [];
4637
4669
  }
4638
4670
  const submodules = [];
4639
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
4671
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
4640
4672
  const match = line.match(/^[ +-U]?([a-f0-9]+) (.+?)(?: \((.+)\))?$/);
4641
4673
  if (match) {
4642
4674
  const commit = match[1];
@@ -4647,13 +4679,13 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4647
4679
  const urlResult = await this.runner.run(
4648
4680
  this.context,
4649
4681
  ["config", "-f", ".gitmodules", "--get", `submodule.${path}.url`],
4650
- { signal: _optionalChain([opts, 'optionalAccess', _787 => _787.signal]) }
4682
+ { signal: _optionalChain([opts, 'optionalAccess', _789 => _789.signal]) }
4651
4683
  );
4652
4684
  const url = urlResult.exitCode === 0 ? urlResult.stdout.trim() : "";
4653
4685
  const branchResult = await this.runner.run(
4654
4686
  this.context,
4655
4687
  ["config", "-f", ".gitmodules", "--get", `submodule.${path}.branch`],
4656
- { signal: _optionalChain([opts, 'optionalAccess', _788 => _788.signal]) }
4688
+ { signal: _optionalChain([opts, 'optionalAccess', _790 => _790.signal]) }
4657
4689
  );
4658
4690
  const branch = branchResult.exitCode === 0 ? branchResult.stdout.trim() : void 0;
4659
4691
  submodules.push({
@@ -4673,69 +4705,69 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4673
4705
  args.push("--", ...paths);
4674
4706
  }
4675
4707
  await this.runner.runOrThrow(this.context, args, {
4676
- signal: _optionalChain([opts, 'optionalAccess', _789 => _789.signal])
4708
+ signal: _optionalChain([opts, 'optionalAccess', _791 => _791.signal])
4677
4709
  });
4678
4710
  }
4679
4711
  async submoduleUpdate(opts) {
4680
4712
  await this.runner.validateFilterOptions(this.context, "submoduleUpdate", opts, {
4681
- signal: _optionalChain([opts, 'optionalAccess', _790 => _790.signal])
4713
+ signal: _optionalChain([opts, 'optionalAccess', _792 => _792.signal])
4682
4714
  });
4683
4715
  const args = ["submodule", "update"];
4684
- if (_optionalChain([opts, 'optionalAccess', _791 => _791.init])) {
4716
+ if (_optionalChain([opts, 'optionalAccess', _793 => _793.init])) {
4685
4717
  args.push("--init");
4686
4718
  }
4687
- if (_optionalChain([opts, 'optionalAccess', _792 => _792.recursive])) {
4719
+ if (_optionalChain([opts, 'optionalAccess', _794 => _794.recursive])) {
4688
4720
  args.push("--recursive");
4689
4721
  }
4690
- if (_optionalChain([opts, 'optionalAccess', _793 => _793.remote])) {
4722
+ if (_optionalChain([opts, 'optionalAccess', _795 => _795.remote])) {
4691
4723
  args.push("--remote");
4692
4724
  }
4693
- if (_optionalChain([opts, 'optionalAccess', _794 => _794.force])) {
4725
+ if (_optionalChain([opts, 'optionalAccess', _796 => _796.force])) {
4694
4726
  args.push("--force");
4695
4727
  }
4696
- if (_optionalChain([opts, 'optionalAccess', _795 => _795.noFetch])) {
4728
+ if (_optionalChain([opts, 'optionalAccess', _797 => _797.noFetch])) {
4697
4729
  args.push("--no-fetch");
4698
4730
  }
4699
- if (_optionalChain([opts, 'optionalAccess', _796 => _796.checkout])) {
4731
+ if (_optionalChain([opts, 'optionalAccess', _798 => _798.checkout])) {
4700
4732
  args.push("--checkout");
4701
4733
  }
4702
- if (_optionalChain([opts, 'optionalAccess', _797 => _797.merge])) {
4734
+ if (_optionalChain([opts, 'optionalAccess', _799 => _799.merge])) {
4703
4735
  args.push("--merge");
4704
4736
  }
4705
- if (_optionalChain([opts, 'optionalAccess', _798 => _798.rebase])) {
4737
+ if (_optionalChain([opts, 'optionalAccess', _800 => _800.rebase])) {
4706
4738
  args.push("--rebase");
4707
4739
  }
4708
- if (_optionalChain([opts, 'optionalAccess', _799 => _799.recommendShallow])) {
4740
+ if (_optionalChain([opts, 'optionalAccess', _801 => _801.recommendShallow])) {
4709
4741
  args.push("--recommend-shallow");
4710
4742
  }
4711
- if (_optionalChain([opts, 'optionalAccess', _800 => _800.reference])) {
4743
+ if (_optionalChain([opts, 'optionalAccess', _802 => _802.reference]) !== void 0) {
4712
4744
  args.push(`--reference=${opts.reference}`);
4713
4745
  }
4714
- if (_optionalChain([opts, 'optionalAccess', _801 => _801.singleBranch])) {
4746
+ if (_optionalChain([opts, 'optionalAccess', _803 => _803.singleBranch])) {
4715
4747
  args.push("--single-branch");
4716
4748
  }
4717
- if (_optionalChain([opts, 'optionalAccess', _802 => _802.filter])) {
4718
- args.push(`--filter=${opts.filter}`);
4749
+ if (_optionalChain([opts, 'optionalAccess', _804 => _804.filter]) !== void 0) {
4750
+ args.push(`--filter=${checkedOptionValue("submodule.update", "filter", opts.filter)}`);
4719
4751
  }
4720
4752
  await this.runner.runOrThrow(this.context, args, {
4721
- signal: _optionalChain([opts, 'optionalAccess', _803 => _803.signal])
4753
+ signal: _optionalChain([opts, 'optionalAccess', _805 => _805.signal])
4722
4754
  });
4723
4755
  }
4724
4756
  async submoduleAdd(url, path, opts) {
4725
4757
  const args = ["submodule", "add"];
4726
- if (_optionalChain([opts, 'optionalAccess', _804 => _804.branch])) {
4727
- args.push("-b", opts.branch);
4758
+ if (_optionalChain([opts, 'optionalAccess', _806 => _806.branch]) !== void 0) {
4759
+ args.push("-b", checkedOptionValue("submodule.add", "branch", opts.branch));
4728
4760
  }
4729
- if (_optionalChain([opts, 'optionalAccess', _805 => _805.force])) {
4761
+ if (_optionalChain([opts, 'optionalAccess', _807 => _807.force])) {
4730
4762
  args.push("--force");
4731
4763
  }
4732
- if (_optionalChain([opts, 'optionalAccess', _806 => _806.name])) {
4733
- args.push("--name", opts.name);
4764
+ if (_optionalChain([opts, 'optionalAccess', _808 => _808.name]) !== void 0) {
4765
+ args.push("--name", checkedOptionValue("submodule.add", "name", opts.name));
4734
4766
  }
4735
- if (_optionalChain([opts, 'optionalAccess', _807 => _807.reference])) {
4736
- args.push("--reference", opts.reference);
4767
+ if (_optionalChain([opts, 'optionalAccess', _809 => _809.reference]) !== void 0) {
4768
+ args.push("--reference", checkedOptionValue("submodule.add", "reference", opts.reference));
4737
4769
  }
4738
- if (_optionalChain([opts, 'optionalAccess', _808 => _808.depth]) !== void 0) {
4770
+ if (_optionalChain([opts, 'optionalAccess', _810 => _810.depth]) !== void 0) {
4739
4771
  args.push("--depth", String(opts.depth));
4740
4772
  }
4741
4773
  args.push(
@@ -4743,92 +4775,92 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4743
4775
  checkedOperand("submodule.add", "path", path)
4744
4776
  );
4745
4777
  await this.runner.runOrThrow(this.context, args, {
4746
- signal: _optionalChain([opts, 'optionalAccess', _809 => _809.signal])
4778
+ signal: _optionalChain([opts, 'optionalAccess', _811 => _811.signal])
4747
4779
  });
4748
4780
  }
4749
4781
  async submoduleDeinit(path, opts) {
4750
4782
  const args = ["submodule", "deinit"];
4751
- if (_optionalChain([opts, 'optionalAccess', _810 => _810.force])) {
4783
+ if (_optionalChain([opts, 'optionalAccess', _812 => _812.force])) {
4752
4784
  args.push("--force");
4753
4785
  }
4754
- if (_optionalChain([opts, 'optionalAccess', _811 => _811.all])) {
4786
+ if (_optionalChain([opts, 'optionalAccess', _813 => _813.all])) {
4755
4787
  args.push("--all");
4756
4788
  } else {
4757
4789
  args.push(checkedOperand("submodule.deinit", "path", path));
4758
4790
  }
4759
4791
  await this.runner.runOrThrow(this.context, args, {
4760
- signal: _optionalChain([opts, 'optionalAccess', _812 => _812.signal])
4792
+ signal: _optionalChain([opts, 'optionalAccess', _814 => _814.signal])
4761
4793
  });
4762
4794
  }
4763
4795
  async submoduleStatus(paths, opts) {
4764
4796
  const args = ["submodule", "status"];
4765
- if (_optionalChain([opts, 'optionalAccess', _813 => _813.recursive])) {
4797
+ if (_optionalChain([opts, 'optionalAccess', _815 => _815.recursive])) {
4766
4798
  args.push("--recursive");
4767
4799
  }
4768
4800
  if (paths && paths.length > 0) {
4769
4801
  args.push("--", ...paths);
4770
4802
  }
4771
4803
  const result = await this.runner.runOrThrow(this.context, args, {
4772
- signal: _optionalChain([opts, 'optionalAccess', _814 => _814.signal])
4804
+ signal: _optionalChain([opts, 'optionalAccess', _816 => _816.signal])
4773
4805
  });
4774
4806
  return result.stdout;
4775
4807
  }
4776
4808
  async submoduleSummary(opts) {
4777
4809
  const args = ["submodule", "summary"];
4778
- if (_optionalChain([opts, 'optionalAccess', _815 => _815.limit]) !== void 0) {
4810
+ if (_optionalChain([opts, 'optionalAccess', _817 => _817.limit]) !== void 0) {
4779
4811
  args.push("-n", String(opts.limit));
4780
4812
  }
4781
- if (_optionalChain([opts, 'optionalAccess', _816 => _816.files])) {
4813
+ if (_optionalChain([opts, 'optionalAccess', _818 => _818.files])) {
4782
4814
  args.push("--files");
4783
4815
  }
4784
4816
  const result = await this.runner.runOrThrow(this.context, args, {
4785
- signal: _optionalChain([opts, 'optionalAccess', _817 => _817.signal])
4817
+ signal: _optionalChain([opts, 'optionalAccess', _819 => _819.signal])
4786
4818
  });
4787
4819
  return result.stdout;
4788
4820
  }
4789
4821
  async submoduleForeach(command, opts) {
4790
4822
  const args = ["submodule", "foreach"];
4791
- if (_optionalChain([opts, 'optionalAccess', _818 => _818.recursive])) {
4823
+ if (_optionalChain([opts, 'optionalAccess', _820 => _820.recursive])) {
4792
4824
  args.push("--recursive");
4793
4825
  }
4794
4826
  args.push(checkedOperand("submodule.foreach", "command", command));
4795
4827
  const result = await this.runner.runOrThrow(this.context, args, {
4796
- signal: _optionalChain([opts, 'optionalAccess', _819 => _819.signal])
4828
+ signal: _optionalChain([opts, 'optionalAccess', _821 => _821.signal])
4797
4829
  });
4798
4830
  return result.stdout;
4799
4831
  }
4800
4832
  async submoduleSync(paths, opts) {
4801
4833
  const args = ["submodule", "sync"];
4802
- if (_optionalChain([opts, 'optionalAccess', _820 => _820.recursive])) {
4834
+ if (_optionalChain([opts, 'optionalAccess', _822 => _822.recursive])) {
4803
4835
  args.push("--recursive");
4804
4836
  }
4805
4837
  if (paths && paths.length > 0) {
4806
4838
  args.push("--", ...paths);
4807
4839
  }
4808
4840
  await this.runner.runOrThrow(this.context, args, {
4809
- signal: _optionalChain([opts, 'optionalAccess', _821 => _821.signal])
4841
+ signal: _optionalChain([opts, 'optionalAccess', _823 => _823.signal])
4810
4842
  });
4811
4843
  }
4812
4844
  async submoduleAbsorbGitDirs(opts) {
4813
4845
  await this.runner.runOrThrow(this.context, ["submodule", "absorbgitdirs"], {
4814
- signal: _optionalChain([opts, 'optionalAccess', _822 => _822.signal])
4846
+ signal: _optionalChain([opts, 'optionalAccess', _824 => _824.signal])
4815
4847
  });
4816
4848
  }
4817
4849
  async submoduleSetBranch(path, branch, opts) {
4818
4850
  const args = ["submodule", "set-branch"];
4819
- if (_optionalChain([opts, 'optionalAccess', _823 => _823.default])) {
4851
+ if (_optionalChain([opts, 'optionalAccess', _825 => _825.default])) {
4820
4852
  args.push("--default");
4821
4853
  } else {
4822
4854
  args.push("--branch", branch);
4823
4855
  }
4824
4856
  args.push("--", path);
4825
4857
  await this.runner.runOrThrow(this.context, args, {
4826
- signal: _optionalChain([opts, 'optionalAccess', _824 => _824.signal])
4858
+ signal: _optionalChain([opts, 'optionalAccess', _826 => _826.signal])
4827
4859
  });
4828
4860
  }
4829
4861
  async submoduleSetUrl(path, url, opts) {
4830
4862
  await this.runner.runOrThrow(this.context, ["submodule", "set-url", "--", path, url], {
4831
- signal: _optionalChain([opts, 'optionalAccess', _825 => _825.signal])
4863
+ signal: _optionalChain([opts, 'optionalAccess', _827 => _827.signal])
4832
4864
  });
4833
4865
  }
4834
4866
  // ==========================================================================
@@ -4836,10 +4868,10 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4836
4868
  // ==========================================================================
4837
4869
  async remoteList(opts) {
4838
4870
  const result = await this.runner.runOrThrow(this.context, ["remote", "-v"], {
4839
- signal: _optionalChain([opts, 'optionalAccess', _826 => _826.signal])
4871
+ signal: _optionalChain([opts, 'optionalAccess', _828 => _828.signal])
4840
4872
  });
4841
4873
  const remotes = /* @__PURE__ */ new Map();
4842
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
4874
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
4843
4875
  const match = line.match(/^(\S+)\t(.+?)\s+\((fetch|push)\)$/);
4844
4876
  if (match) {
4845
4877
  const name = match[1];
@@ -4874,27 +4906,27 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4874
4906
  return Array.from(remotes.values());
4875
4907
  }
4876
4908
  async remoteAdd(name, url, opts) {
4877
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "remoteAdd", opts);
4909
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "remoteAdd", opts);
4878
4910
  const args = ["remote", "add"];
4879
- if (_optionalChain([opts, 'optionalAccess', _827 => _827.track])) {
4911
+ if (_optionalChain([opts, 'optionalAccess', _829 => _829.track]) !== void 0) {
4880
4912
  args.push("-t", opts.track);
4881
4913
  }
4882
- if (_optionalChain([opts, 'optionalAccess', _828 => _828.fetch])) {
4914
+ if (_optionalChain([opts, 'optionalAccess', _830 => _830.fetch])) {
4883
4915
  args.push("-f");
4884
4916
  }
4885
- if (_optionalChain([opts, 'optionalAccess', _829 => _829.mirror]) === "fetch") {
4917
+ if (_optionalChain([opts, 'optionalAccess', _831 => _831.mirror]) === "fetch") {
4886
4918
  args.push("--mirror=fetch");
4887
- } else if (_optionalChain([opts, 'optionalAccess', _830 => _830.mirror]) === "push") {
4919
+ } else if (_optionalChain([opts, 'optionalAccess', _832 => _832.mirror]) === "push") {
4888
4920
  args.push("--mirror=push");
4889
4921
  }
4890
- if (_optionalChain([opts, 'optionalAccess', _831 => _831.tags]) === true) {
4922
+ if (_optionalChain([opts, 'optionalAccess', _833 => _833.tags]) === true) {
4891
4923
  args.push("--tags");
4892
- } else if (_optionalChain([opts, 'optionalAccess', _832 => _832.tags]) === false) {
4924
+ } else if (_optionalChain([opts, 'optionalAccess', _834 => _834.tags]) === false) {
4893
4925
  args.push("--no-tags");
4894
4926
  }
4895
4927
  args.push(checkedOperand("remote.add", "name", name), checkedOperand("remote.add", "url", url));
4896
4928
  await this.runner.runOrThrow(this.context, args, {
4897
- signal: _optionalChain([opts, 'optionalAccess', _833 => _833.signal])
4929
+ signal: _optionalChain([opts, 'optionalAccess', _835 => _835.signal])
4898
4930
  });
4899
4931
  }
4900
4932
  async remoteRemove(name, opts) {
@@ -4902,7 +4934,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4902
4934
  this.context,
4903
4935
  ["remote", "remove", checkedOperand("remote.remove", "name", name)],
4904
4936
  {
4905
- signal: _optionalChain([opts, 'optionalAccess', _834 => _834.signal])
4937
+ signal: _optionalChain([opts, 'optionalAccess', _836 => _836.signal])
4906
4938
  }
4907
4939
  );
4908
4940
  }
@@ -4916,24 +4948,24 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4916
4948
  checkedOperand("remote.rename", "newName", newName)
4917
4949
  ],
4918
4950
  {
4919
- signal: _optionalChain([opts, 'optionalAccess', _835 => _835.signal])
4951
+ signal: _optionalChain([opts, 'optionalAccess', _837 => _837.signal])
4920
4952
  }
4921
4953
  );
4922
4954
  }
4923
4955
  async remoteGetUrl(name, opts) {
4924
4956
  const args = ["remote", "get-url"];
4925
- if (_optionalChain([opts, 'optionalAccess', _836 => _836.push])) {
4957
+ if (_optionalChain([opts, 'optionalAccess', _838 => _838.push])) {
4926
4958
  args.push("--push");
4927
4959
  }
4928
4960
  args.push(checkedOperand("remote.getUrl", "name", name));
4929
4961
  const result = await this.runner.runOrThrow(this.context, args, {
4930
- signal: _optionalChain([opts, 'optionalAccess', _837 => _837.signal])
4962
+ signal: _optionalChain([opts, 'optionalAccess', _839 => _839.signal])
4931
4963
  });
4932
4964
  return result.stdout.trim();
4933
4965
  }
4934
4966
  async remoteSetUrl(name, url, opts) {
4935
4967
  const args = ["remote", "set-url"];
4936
- if (_optionalChain([opts, 'optionalAccess', _838 => _838.push])) {
4968
+ if (_optionalChain([opts, 'optionalAccess', _840 => _840.push])) {
4937
4969
  args.push("--push");
4938
4970
  }
4939
4971
  args.push(
@@ -4941,49 +4973,55 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4941
4973
  checkedOperand("remote.setUrl", "url", url)
4942
4974
  );
4943
4975
  await this.runner.runOrThrow(this.context, args, {
4944
- signal: _optionalChain([opts, 'optionalAccess', _839 => _839.signal])
4976
+ signal: _optionalChain([opts, 'optionalAccess', _841 => _841.signal])
4945
4977
  });
4946
4978
  }
4947
4979
  async remoteSetHead(remote, branch, opts) {
4948
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "remoteSetHead", opts);
4980
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "remoteSetHead", opts);
4949
4981
  const args = ["remote", "set-head"];
4950
- if (_optionalChain([opts, 'optionalAccess', _840 => _840.auto])) {
4982
+ if (_optionalChain([opts, 'optionalAccess', _842 => _842.auto])) {
4951
4983
  args.push("--auto");
4952
- } else if (_optionalChain([opts, 'optionalAccess', _841 => _841.delete])) {
4984
+ } else if (_optionalChain([opts, 'optionalAccess', _843 => _843.delete])) {
4953
4985
  args.push("--delete");
4954
4986
  }
4955
4987
  args.push(checkedOperand("remote.setHead", "remote", remote));
4956
- if (branch && !_optionalChain([opts, 'optionalAccess', _842 => _842.auto]) && !_optionalChain([opts, 'optionalAccess', _843 => _843.delete])) {
4957
- args.push(checkedOperand("remote.setHead", "branch", branch));
4988
+ if (branch !== void 0 && !_optionalChain([opts, 'optionalAccess', _844 => _844.auto]) && !_optionalChain([opts, 'optionalAccess', _845 => _845.delete])) {
4989
+ args.push(
4990
+ checkedOperand(
4991
+ "remote.setHead",
4992
+ "branch",
4993
+ checkedOptionValue("remote.setHead", "branch", branch)
4994
+ )
4995
+ );
4958
4996
  }
4959
4997
  await this.runner.runOrThrow(this.context, args, {
4960
- signal: _optionalChain([opts, 'optionalAccess', _844 => _844.signal])
4998
+ signal: _optionalChain([opts, 'optionalAccess', _846 => _846.signal])
4961
4999
  });
4962
5000
  }
4963
5001
  async remoteShow(remote, opts) {
4964
5002
  const args = ["remote", "show"];
4965
- if (_optionalChain([opts, 'optionalAccess', _845 => _845.noQuery])) {
5003
+ if (_optionalChain([opts, 'optionalAccess', _847 => _847.noQuery])) {
4966
5004
  args.push("-n");
4967
5005
  }
4968
5006
  args.push(checkedOperand("remote.show", "remote", remote));
4969
5007
  const result = await this.runner.runOrThrow(this.context, args, {
4970
- signal: _optionalChain([opts, 'optionalAccess', _846 => _846.signal])
5008
+ signal: _optionalChain([opts, 'optionalAccess', _848 => _848.signal])
4971
5009
  });
4972
5010
  return result.stdout;
4973
5011
  }
4974
5012
  async remotePrune(remote, opts) {
4975
5013
  const args = ["remote", "prune"];
4976
- if (_optionalChain([opts, 'optionalAccess', _847 => _847.dryRun])) {
5014
+ if (_optionalChain([opts, 'optionalAccess', _849 => _849.dryRun])) {
4977
5015
  args.push("--dry-run");
4978
5016
  }
4979
5017
  args.push(checkedOperand("remote.prune", "remote", remote));
4980
5018
  const result = await this.runner.runOrThrow(this.context, args, {
4981
- signal: _optionalChain([opts, 'optionalAccess', _848 => _848.signal])
5019
+ signal: _optionalChain([opts, 'optionalAccess', _850 => _850.signal])
4982
5020
  });
4983
5021
  const pruned = [];
4984
- for (const line of _chunk6HDMSFY7cjs.parseLines.call(void 0, result.stdout)) {
5022
+ for (const line of _chunkRWKMVYO5cjs.parseLines.call(void 0, result.stdout)) {
4985
5023
  const match = line.match(/\* \[pruned\] (.+)/);
4986
- const ref = _optionalChain([match, 'optionalAccess', _849 => _849[1]]);
5024
+ const ref = _optionalChain([match, 'optionalAccess', _851 => _851[1]]);
4987
5025
  if (ref) {
4988
5026
  pruned.push(ref);
4989
5027
  }
@@ -4992,19 +5030,19 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
4992
5030
  }
4993
5031
  async remoteUpdate(remotes, opts) {
4994
5032
  const args = ["remote", "update"];
4995
- if (_optionalChain([opts, 'optionalAccess', _850 => _850.prune])) {
5033
+ if (_optionalChain([opts, 'optionalAccess', _852 => _852.prune])) {
4996
5034
  args.push("--prune");
4997
5035
  }
4998
5036
  if (remotes && remotes.length > 0) {
4999
5037
  args.push(...checkedOperands("remote.update", "remotes", remotes));
5000
5038
  }
5001
5039
  await this.runner.runOrThrow(this.context, args, {
5002
- signal: _optionalChain([opts, 'optionalAccess', _851 => _851.signal])
5040
+ signal: _optionalChain([opts, 'optionalAccess', _853 => _853.signal])
5003
5041
  });
5004
5042
  }
5005
5043
  async remoteSetBranches(remote, branches, opts) {
5006
5044
  const args = ["remote", "set-branches"];
5007
- if (_optionalChain([opts, 'optionalAccess', _852 => _852.add])) {
5045
+ if (_optionalChain([opts, 'optionalAccess', _854 => _854.add])) {
5008
5046
  args.push("--add");
5009
5047
  }
5010
5048
  args.push(
@@ -5012,7 +5050,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5012
5050
  ...checkedOperands("remote.setBranches", "branches", branches)
5013
5051
  );
5014
5052
  await this.runner.runOrThrow(this.context, args, {
5015
- signal: _optionalChain([opts, 'optionalAccess', _853 => _853.signal])
5053
+ signal: _optionalChain([opts, 'optionalAccess', _855 => _855.signal])
5016
5054
  });
5017
5055
  }
5018
5056
  // ==========================================================================
@@ -5039,7 +5077,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5039
5077
  this.context,
5040
5078
  ["config", "--", checkedOperand("config.set", "key", key), String(value)],
5041
5079
  {
5042
- signal: _optionalChain([opts, 'optionalAccess', _854 => _854.signal])
5080
+ signal: _optionalChain([opts, 'optionalAccess', _856 => _856.signal])
5043
5081
  }
5044
5082
  );
5045
5083
  }
@@ -5051,7 +5089,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5051
5089
  this.context,
5052
5090
  ["config", "--add", "--", checkedOperand("config.add", "key", key), String(value)],
5053
5091
  {
5054
- signal: _optionalChain([opts, 'optionalAccess', _855 => _855.signal])
5092
+ signal: _optionalChain([opts, 'optionalAccess', _857 => _857.signal])
5055
5093
  }
5056
5094
  );
5057
5095
  }
@@ -5063,7 +5101,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5063
5101
  this.context,
5064
5102
  ["config", "--unset", checkedOperand("config.unset", "key", key)],
5065
5103
  {
5066
- signal: _optionalChain([opts, 'optionalAccess', _856 => _856.signal])
5104
+ signal: _optionalChain([opts, 'optionalAccess', _858 => _858.signal])
5067
5105
  }
5068
5106
  );
5069
5107
  }
@@ -5075,12 +5113,12 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5075
5113
  */
5076
5114
  async configSetRaw(key, value, opts) {
5077
5115
  const args = ["config"];
5078
- if (_optionalChain([opts, 'optionalAccess', _857 => _857.add])) {
5116
+ if (_optionalChain([opts, 'optionalAccess', _859 => _859.add])) {
5079
5117
  args.push("--add");
5080
5118
  }
5081
5119
  args.push("--", checkedOperand("config.setRaw", "key", key), value);
5082
5120
  await this.runner.runOrThrow(this.context, args, {
5083
- signal: _optionalChain([opts, 'optionalAccess', _858 => _858.signal])
5121
+ signal: _optionalChain([opts, 'optionalAccess', _860 => _860.signal])
5084
5122
  });
5085
5123
  }
5086
5124
  /**
@@ -5091,7 +5129,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5091
5129
  this.context,
5092
5130
  ["config", "--unset", checkedOperand("config.unsetRaw", "key", key)],
5093
5131
  {
5094
- signal: _optionalChain([opts, 'optionalAccess', _859 => _859.signal])
5132
+ signal: _optionalChain([opts, 'optionalAccess', _861 => _861.signal])
5095
5133
  }
5096
5134
  );
5097
5135
  }
@@ -5111,7 +5149,7 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5111
5149
  checkedOperand("config.renameSection", "newName", newName)
5112
5150
  ],
5113
5151
  {
5114
- signal: _optionalChain([opts, 'optionalAccess', _860 => _860.signal])
5152
+ signal: _optionalChain([opts, 'optionalAccess', _862 => _862.signal])
5115
5153
  }
5116
5154
  );
5117
5155
  }
@@ -5120,18 +5158,18 @@ var WorktreeRepoImpl = (_class2 = class _WorktreeRepoImpl {
5120
5158
  this.context,
5121
5159
  ["config", "--remove-section", checkedOperand("config.removeSection", "name", name)],
5122
5160
  {
5123
- signal: _optionalChain([opts, 'optionalAccess', _861 => _861.signal])
5161
+ signal: _optionalChain([opts, 'optionalAccess', _863 => _863.signal])
5124
5162
  }
5125
5163
  );
5126
5164
  }
5127
5165
  }, _class2);
5128
5166
  function checkRebaseBackend(opts) {
5129
- if (!(_optionalChain([opts, 'optionalAccess', _862 => _862.apply]) || _optionalChain([opts, 'optionalAccess', _863 => _863.whitespace]))) {
5167
+ if (!(_optionalChain([opts, 'optionalAccess', _864 => _864.apply]) || _optionalChain([opts, 'optionalAccess', _865 => _865.whitespace]))) {
5130
5168
  return;
5131
5169
  }
5132
5170
  const implied = opts.root && !opts.onto ? "--root without --onto" : opts.reapplyCherryPicks !== void 0 && !opts.keepBase ? "--[no-]reapply-cherry-picks without --keep-base" : !opts.apply && opts.ignoreWhitespace ? "--ignore-whitespace without --apply" : void 0;
5133
5171
  if (implied) {
5134
- throw new (0, _chunk6HDMSFY7cjs.GitArgumentError)(
5172
+ throw new (0, _chunkRWKMVYO5cjs.GitArgumentError)(
5135
5173
  `rebase: ${implied} implies the merge backend, which apply options cannot use [rebase.apply-implied-merge]`
5136
5174
  );
5137
5175
  }
@@ -5249,7 +5287,7 @@ function toCliRunnerOptions(opts) {
5249
5287
  }
5250
5288
  async function listDirectory(fs, dirPath) {
5251
5289
  if (fs.readDirectory === void 0) {
5252
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5290
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5253
5291
  "CapabilityMissing",
5254
5292
  "untrusted: true needs a file system adapter that implements readDirectory"
5255
5293
  );
@@ -5260,7 +5298,7 @@ async function assertDataOnlyRepoConfig(runner, fs, context, label, allowWorktre
5260
5298
  const where = context.type === "bare" ? { gitDir: context.gitDir } : { workdir: context.workdir };
5261
5299
  const result = await runner.run(context, ["config", "--list", "--show-scope", "-z"]);
5262
5300
  if (result.exitCode !== 0) {
5263
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5301
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5264
5302
  "UnsafeRepoConfig",
5265
5303
  `Could not read the configuration of untrusted repository ${label}`,
5266
5304
  { ...where, exitCode: result.exitCode, stderr: result.stderr }
@@ -5270,7 +5308,7 @@ async function assertDataOnlyRepoConfig(runner, fs, context, label, allowWorktre
5270
5308
  (key) => !(allowWorktree && key.toLowerCase() === "core.worktree")
5271
5309
  );
5272
5310
  if (unsafe.length > 0) {
5273
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5311
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5274
5312
  "UnsafeRepoConfig",
5275
5313
  `Refusing untrusted repository ${label}: its configuration sets keys that are not data-only: ${unsafe.join(", ")}`,
5276
5314
  where
@@ -5283,14 +5321,14 @@ async function assertDataOnlyRepoConfig(runner, fs, context, label, allowWorktre
5283
5321
  name
5284
5322
  ]);
5285
5323
  if (located.exitCode !== 0) {
5286
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5324
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5287
5325
  "UnsafeRepoConfig",
5288
5326
  `Could not locate the Git directory of untrusted repository ${label}`,
5289
5327
  { ...where, exitCode: located.exitCode, stderr: located.stderr }
5290
5328
  );
5291
5329
  }
5292
5330
  if ((await listDirectory(fs, located.path)).length > 0) {
5293
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5331
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5294
5332
  "UnsafeRepoConfig",
5295
5333
  `Refusing untrusted repository ${label}: ${located.path} defines remotes outside its configuration`,
5296
5334
  where
@@ -5317,7 +5355,7 @@ async function assertDataOnlySubmoduleConfigs(runner, fs, workdir, label, expect
5317
5355
  const index = await runner.run(context, ["ls-files", "--stage", "-z", "--full-name", "--", ":/"]);
5318
5356
  const failed = [topResult, gitDirResult, index].find((result) => result.exitCode !== 0);
5319
5357
  if (failed !== void 0) {
5320
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5358
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5321
5359
  "UnsafeRepoConfig",
5322
5360
  `Could not list the submodules of untrusted repository ${label}`,
5323
5361
  { workdir, exitCode: failed.exitCode, stderr: failed.stderr }
@@ -5326,7 +5364,7 @@ async function assertDataOnlySubmoduleConfigs(runner, fs, workdir, label, expect
5326
5364
  const top = topResult.path;
5327
5365
  const gitDir = gitDirResult.path;
5328
5366
  if (expectedTop !== void 0 && top !== expectedTop) {
5329
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5367
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5330
5368
  "UnsafeRepoConfig",
5331
5369
  `Refusing untrusted repository ${label}: its core.worktree points at ${top}`,
5332
5370
  { workdir }
@@ -5346,7 +5384,7 @@ async function assertDataOnlySubmoduleConfigs(runner, fs, workdir, label, expect
5346
5384
  const subContext = { type: "worktree", workdir: subdir };
5347
5385
  const subGitDir = await revParsePath(runner, subContext, ["--absolute-git-dir"]);
5348
5386
  if (subGitDir.exitCode !== 0) {
5349
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5387
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5350
5388
  "UnsafeRepoConfig",
5351
5389
  `Could not open submodule of untrusted repository ${sublabel}`,
5352
5390
  { workdir: subdir, exitCode: subGitDir.exitCode, stderr: subGitDir.stderr }
@@ -5360,7 +5398,7 @@ async function assertDataOnlySubmoduleConfigs(runner, fs, workdir, label, expect
5360
5398
  }
5361
5399
  }
5362
5400
  function gitDirRefusal(path, exitCode, stderr) {
5363
- return new (0, _chunk6HDMSFY7cjs.GitError)(
5401
+ return new (0, _chunkRWKMVYO5cjs.GitError)(
5364
5402
  "NonZeroExit",
5365
5403
  `Not a worktree or bare repository: ${path}. In untrusted mode, open a worktree by its top-level directory, not its .git directory`,
5366
5404
  { exitCode, stderr }
@@ -5373,8 +5411,8 @@ var GitImpl = (_class3 = class {
5373
5411
 
5374
5412
 
5375
5413
  constructor(options) {;_class3.prototype.__init4.call(this);
5376
- this.runner = new (0, _chunk6HDMSFY7cjs.CliRunner)(options.adapters, options);
5377
- _chunk6HDMSFY7cjs.registerCommandHost.call(void 0, this, () => ({
5414
+ this.runner = new (0, _chunkRWKMVYO5cjs.CliRunner)(options.adapters, options);
5415
+ _chunkRWKMVYO5cjs.registerCommandHost.call(void 0, this, () => ({
5378
5416
  runner: this.runner,
5379
5417
  context: { type: "global" },
5380
5418
  inRepository: void 0
@@ -5404,7 +5442,7 @@ var GitImpl = (_class3 = class {
5404
5442
  async open(path, opts) {
5405
5443
  const repo = await this.openRaw(path, opts);
5406
5444
  if (!("workdir" in repo)) {
5407
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5445
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5408
5446
  "NotWorktreeRepo",
5409
5447
  `Expected worktree repository but found bare repository: ${path}`,
5410
5448
  {
@@ -5421,7 +5459,7 @@ var GitImpl = (_class3 = class {
5421
5459
  async openBare(path, opts) {
5422
5460
  const repo = await this.openRaw(path, opts);
5423
5461
  if ("workdir" in repo) {
5424
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5462
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5425
5463
  "NotBareRepo",
5426
5464
  `Expected bare repository but found worktree repository: ${path}`,
5427
5465
  {
@@ -5436,17 +5474,17 @@ var GitImpl = (_class3 = class {
5436
5474
  * Returns either WorktreeRepo or BareRepo depending on the repository type.
5437
5475
  */
5438
5476
  async openRaw(path, opts) {
5439
- if (_optionalChain([opts, 'optionalAccess', _864 => _864.untrusted]) === true) {
5477
+ if (_optionalChain([opts, 'optionalAccess', _866 => _866.untrusted]) === true) {
5440
5478
  const version = await this.version();
5441
5479
  if (compareVersions(version, UNTRUSTED_REPO_MIN_GIT_VERSION) < 0) {
5442
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5480
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5443
5481
  "UnsupportedGitVersion",
5444
5482
  `untrusted: true needs Git ${UNTRUSTED_REPO_MIN_GIT_VERSION} or later (found ${version})`
5445
5483
  );
5446
5484
  }
5447
5485
  }
5448
5486
  const repoRunner = opts ? this.runner.withOptions(toCliRunnerOptions(opts)) : this.runner;
5449
- const untrusted = _optionalChain([opts, 'optionalAccess', _865 => _865.untrusted]) === true;
5487
+ const untrusted = _optionalChain([opts, 'optionalAccess', _867 => _867.untrusted]) === true;
5450
5488
  const result = await repoRunner.run({ type: "worktree", workdir: path }, [
5451
5489
  "rev-parse",
5452
5490
  "--is-bare-repository",
@@ -5458,13 +5496,13 @@ var GitImpl = (_class3 = class {
5458
5496
  "--is-bare-repository"
5459
5497
  ]);
5460
5498
  if (bareResult.exitCode !== 0) {
5461
- throw new (0, _chunk6HDMSFY7cjs.GitError)("NonZeroExit", `Not a git repository: ${path}`, {
5499
+ throw new (0, _chunkRWKMVYO5cjs.GitError)("NonZeroExit", `Not a git repository: ${path}`, {
5462
5500
  exitCode: bareResult.exitCode,
5463
5501
  stderr: bareResult.stderr
5464
5502
  });
5465
5503
  }
5466
5504
  if (bareResult.stdout.trim() === "true") {
5467
- if (_optionalChain([opts, 'optionalAccess', _866 => _866.untrusted]) === true) {
5505
+ if (_optionalChain([opts, 'optionalAccess', _868 => _868.untrusted]) === true) {
5468
5506
  await assertDataOnlyRepoConfig(
5469
5507
  repoRunner,
5470
5508
  this.adapters.fs,
@@ -5504,44 +5542,44 @@ var GitImpl = (_class3 = class {
5504
5542
  const checkedPath = checkedOperand("clone", "path", path);
5505
5543
  const args = buildCloneArgs(opts);
5506
5544
  await this.runner.validateFilterOptions({ type: "global" }, "clone", opts, {
5507
- signal: _optionalChain([opts, 'optionalAccess', _867 => _867.signal])
5545
+ signal: _optionalChain([opts, 'optionalAccess', _869 => _869.signal])
5508
5546
  });
5509
- if (_optionalChain([opts, 'optionalAccess', _868 => _868.onProgress]) || _optionalChain([opts, 'optionalAccess', _869 => _869.onLfsProgress])) {
5547
+ if (_optionalChain([opts, 'optionalAccess', _870 => _870.onProgress]) || _optionalChain([opts, 'optionalAccess', _871 => _871.onLfsProgress])) {
5510
5548
  args.push("--progress");
5511
5549
  }
5512
5550
  args.push(checkedUrl, checkedPath);
5513
5551
  const destinationExisted = await this.adapters.fs.exists(path);
5514
- const alreadyAborted = _optionalChain([opts, 'optionalAccess', _870 => _870.signal, 'optionalAccess', _871 => _871.aborted]);
5552
+ const alreadyAborted = _optionalChain([opts, 'optionalAccess', _872 => _872.signal, 'optionalAccess', _873 => _873.aborted]);
5515
5553
  try {
5516
5554
  await this.runner.runOrThrow({ type: "global" }, args, {
5517
- signal: _optionalChain([opts, 'optionalAccess', _872 => _872.signal]),
5518
- onProgress: _optionalChain([opts, 'optionalAccess', _873 => _873.onProgress]),
5519
- onLfsProgress: _optionalChain([opts, 'optionalAccess', _874 => _874.onLfsProgress])
5555
+ signal: _optionalChain([opts, 'optionalAccess', _874 => _874.signal]),
5556
+ onProgress: _optionalChain([opts, 'optionalAccess', _875 => _875.onProgress]),
5557
+ onLfsProgress: _optionalChain([opts, 'optionalAccess', _876 => _876.onLfsProgress])
5520
5558
  });
5521
5559
  } catch (error) {
5522
- if (error instanceof _chunk6HDMSFY7cjs.GitError && error.kind === "Aborted" && _optionalChain([opts, 'optionalAccess', _875 => _875.cleanupOnAbort]) !== false && !destinationExisted && !alreadyAborted) {
5560
+ if (error instanceof _chunkRWKMVYO5cjs.GitError && error.kind === "Aborted" && _optionalChain([opts, 'optionalAccess', _877 => _877.cleanupOnAbort]) !== false && !destinationExisted && !alreadyAborted) {
5523
5561
  await this.adapters.fs.deleteDirectory(path);
5524
5562
  }
5525
5563
  throw error;
5526
5564
  }
5527
- if (_optionalChain([opts, 'optionalAccess', _876 => _876.bare]) || _optionalChain([opts, 'optionalAccess', _877 => _877.mirror])) {
5565
+ if (_optionalChain([opts, 'optionalAccess', _878 => _878.bare]) || _optionalChain([opts, 'optionalAccess', _879 => _879.mirror])) {
5528
5566
  return new BareRepoImpl(this.runner, path);
5529
5567
  }
5530
5568
  return new WorktreeRepoImpl(this.runner, path);
5531
5569
  }
5532
5570
  async init(path, opts) {
5533
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "init", opts);
5571
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "init", opts);
5534
5572
  const args = ["init"];
5535
- if (_optionalChain([opts, 'optionalAccess', _878 => _878.quiet])) {
5573
+ if (_optionalChain([opts, 'optionalAccess', _880 => _880.quiet])) {
5536
5574
  args.push("--quiet");
5537
5575
  }
5538
- if (_optionalChain([opts, 'optionalAccess', _879 => _879.bare])) {
5576
+ if (_optionalChain([opts, 'optionalAccess', _881 => _881.bare])) {
5539
5577
  args.push("--bare");
5540
5578
  }
5541
- if (_optionalChain([opts, 'optionalAccess', _880 => _880.template])) {
5579
+ if (_optionalChain([opts, 'optionalAccess', _882 => _882.template]) !== void 0) {
5542
5580
  args.push("--template", opts.template);
5543
5581
  }
5544
- if (_optionalChain([opts, 'optionalAccess', _881 => _881.shared]) !== void 0) {
5582
+ if (_optionalChain([opts, 'optionalAccess', _883 => _883.shared]) !== void 0) {
5545
5583
  if (typeof opts.shared === "boolean") {
5546
5584
  if (opts.shared) {
5547
5585
  args.push("--shared");
@@ -5552,40 +5590,48 @@ var GitImpl = (_class3 = class {
5552
5590
  args.push(`--shared=${opts.shared}`);
5553
5591
  }
5554
5592
  }
5555
- if (_optionalChain([opts, 'optionalAccess', _882 => _882.initialBranch]) && await this.supportsInitialBranch()) {
5556
- args.push("--initial-branch", opts.initialBranch);
5593
+ const initialBranch = _optionalChain([opts, 'optionalAccess', _884 => _884.initialBranch]);
5594
+ const separateGitDir = _optionalChain([opts, 'optionalAccess', _885 => _885.separateGitDir]);
5595
+ if (initialBranch !== void 0) {
5596
+ checkedOptionValue("init", "initialBranch", initialBranch);
5597
+ }
5598
+ if (separateGitDir !== void 0) {
5599
+ checkedOptionValue("init", "separateGitDir", separateGitDir);
5557
5600
  }
5558
- if (_optionalChain([opts, 'optionalAccess', _883 => _883.objectFormat])) {
5601
+ if (initialBranch && await this.supportsInitialBranch()) {
5602
+ args.push("--initial-branch", initialBranch);
5603
+ }
5604
+ if (_optionalChain([opts, 'optionalAccess', _886 => _886.objectFormat])) {
5559
5605
  args.push("--object-format", opts.objectFormat);
5560
5606
  }
5561
- if (_optionalChain([opts, 'optionalAccess', _884 => _884.separateGitDir])) {
5562
- args.push("--separate-git-dir", opts.separateGitDir);
5607
+ if (separateGitDir !== void 0) {
5608
+ args.push("--separate-git-dir", separateGitDir);
5563
5609
  }
5564
5610
  args.push(checkedOperand("init", "path", path));
5565
5611
  const destinationExisted = await this.adapters.fs.exists(path);
5566
- const alreadyAborted = _optionalChain([opts, 'optionalAccess', _885 => _885.signal, 'optionalAccess', _886 => _886.aborted]);
5612
+ const alreadyAborted = _optionalChain([opts, 'optionalAccess', _887 => _887.signal, 'optionalAccess', _888 => _888.aborted]);
5567
5613
  try {
5568
5614
  await this.runner.runOrThrow({ type: "global" }, args, {
5569
- signal: _optionalChain([opts, 'optionalAccess', _887 => _887.signal]),
5570
- onProgress: _optionalChain([opts, 'optionalAccess', _888 => _888.onProgress])
5615
+ signal: _optionalChain([opts, 'optionalAccess', _889 => _889.signal]),
5616
+ onProgress: _optionalChain([opts, 'optionalAccess', _890 => _890.onProgress])
5571
5617
  });
5572
- if (_optionalChain([opts, 'optionalAccess', _889 => _889.initialBranch]) && !await this.supportsInitialBranch()) {
5573
- const context = _optionalChain([opts, 'optionalAccess', _890 => _890.bare]) ? { type: "bare", gitDir: path } : { type: "worktree", workdir: path };
5618
+ if (initialBranch && !await this.supportsInitialBranch()) {
5619
+ const context = _optionalChain([opts, 'optionalAccess', _891 => _891.bare]) ? { type: "bare", gitDir: path } : { type: "worktree", workdir: path };
5574
5620
  await this.runner.runOrThrow(
5575
5621
  context,
5576
- ["symbolic-ref", "HEAD", `refs/heads/${opts.initialBranch}`],
5622
+ ["symbolic-ref", "HEAD", `refs/heads/${initialBranch}`],
5577
5623
  {
5578
- signal: _optionalChain([opts, 'optionalAccess', _891 => _891.signal])
5624
+ signal: _optionalChain([opts, 'optionalAccess', _892 => _892.signal])
5579
5625
  }
5580
5626
  );
5581
5627
  }
5582
5628
  } catch (error) {
5583
- if (error instanceof _chunk6HDMSFY7cjs.GitError && error.kind === "Aborted" && _optionalChain([opts, 'optionalAccess', _892 => _892.cleanupOnAbort]) !== false && !destinationExisted && !alreadyAborted) {
5629
+ if (error instanceof _chunkRWKMVYO5cjs.GitError && error.kind === "Aborted" && _optionalChain([opts, 'optionalAccess', _893 => _893.cleanupOnAbort]) !== false && !destinationExisted && !alreadyAborted) {
5584
5630
  await this.adapters.fs.deleteDirectory(path);
5585
5631
  }
5586
5632
  throw error;
5587
5633
  }
5588
- if (_optionalChain([opts, 'optionalAccess', _893 => _893.bare])) {
5634
+ if (_optionalChain([opts, 'optionalAccess', _894 => _894.bare])) {
5589
5635
  return new BareRepoImpl(this.runner, path);
5590
5636
  }
5591
5637
  return new WorktreeRepoImpl(this.runner, path);
@@ -5594,26 +5640,26 @@ var GitImpl = (_class3 = class {
5594
5640
  * List references in a remote repository
5595
5641
  */
5596
5642
  async lsRemote(url, opts) {
5597
- _chunk6HDMSFY7cjs.validateOptions.call(void 0, "lsRemote", opts);
5643
+ _chunkRWKMVYO5cjs.validateOptions.call(void 0, "lsRemote", opts);
5598
5644
  const args = ["ls-remote"];
5599
- if (_optionalChain([opts, 'optionalAccess', _894 => _894.heads])) {
5645
+ if (_optionalChain([opts, 'optionalAccess', _895 => _895.heads])) {
5600
5646
  args.push("--heads");
5601
5647
  }
5602
- if (_optionalChain([opts, 'optionalAccess', _895 => _895.tags])) {
5648
+ if (_optionalChain([opts, 'optionalAccess', _896 => _896.tags])) {
5603
5649
  args.push("--tags");
5604
5650
  }
5605
- if (_optionalChain([opts, 'optionalAccess', _896 => _896.refs])) {
5651
+ if (_optionalChain([opts, 'optionalAccess', _897 => _897.refs])) {
5606
5652
  args.push("--refs");
5607
5653
  }
5608
- if (_optionalChain([opts, 'optionalAccess', _897 => _897.sort])) {
5609
- args.push("--sort", opts.sort);
5654
+ if (_optionalChain([opts, 'optionalAccess', _898 => _898.sort]) !== void 0) {
5655
+ args.push("--sort", checkedOptionValue("lsRemote", "sort", opts.sort));
5610
5656
  }
5611
5657
  args.push(checkedOperand("lsRemote", "url", url));
5612
5658
  const result = await this.runner.runOrThrow({ type: "global" }, args, {
5613
- signal: _optionalChain([opts, 'optionalAccess', _898 => _898.signal]),
5614
- onProgress: _optionalChain([opts, 'optionalAccess', _899 => _899.onProgress])
5659
+ signal: _optionalChain([opts, 'optionalAccess', _899 => _899.signal]),
5660
+ onProgress: _optionalChain([opts, 'optionalAccess', _900 => _900.onProgress])
5615
5661
  });
5616
- const refs = _chunk6HDMSFY7cjs.parseLsRemote.call(void 0, result.stdout);
5662
+ const refs = _chunkRWKMVYO5cjs.parseLsRemote.call(void 0, result.stdout);
5617
5663
  return { refs };
5618
5664
  }
5619
5665
  /**
@@ -5624,10 +5670,10 @@ var GitImpl = (_class3 = class {
5624
5670
  return this.cachedVersion;
5625
5671
  }
5626
5672
  const result = await this.runner.runOrThrow({ type: "global" }, ["--version"], {
5627
- signal: _optionalChain([opts, 'optionalAccess', _900 => _900.signal])
5673
+ signal: _optionalChain([opts, 'optionalAccess', _901 => _901.signal])
5628
5674
  });
5629
5675
  const match = result.stdout.match(GIT_VERSION_REGEX);
5630
- const version = _nullishCoalesce(_optionalChain([match, 'optionalAccess', _901 => _901[1]]), () => ( result.stdout.trim()));
5676
+ const version = _nullishCoalesce(_optionalChain([match, 'optionalAccess', _902 => _902[1]]), () => ( result.stdout.trim()));
5631
5677
  this.cachedVersion = version;
5632
5678
  return version;
5633
5679
  }
@@ -5666,7 +5712,7 @@ var GitImpl = (_class3 = class {
5666
5712
  { type: "global" },
5667
5713
  ["config", "--global", "--", checkedOperand("config.set", "key", key), String(value)],
5668
5714
  {
5669
- signal: _optionalChain([opts, 'optionalAccess', _902 => _902.signal])
5715
+ signal: _optionalChain([opts, 'optionalAccess', _903 => _903.signal])
5670
5716
  }
5671
5717
  );
5672
5718
  }
@@ -5684,7 +5730,7 @@ var GitImpl = (_class3 = class {
5684
5730
  checkedOperand("config.add", "key", key),
5685
5731
  String(value)
5686
5732
  ],
5687
- { signal: _optionalChain([opts, 'optionalAccess', _903 => _903.signal]) }
5733
+ { signal: _optionalChain([opts, 'optionalAccess', _904 => _904.signal]) }
5688
5734
  );
5689
5735
  }
5690
5736
  /**
@@ -5695,7 +5741,7 @@ var GitImpl = (_class3 = class {
5695
5741
  { type: "global" },
5696
5742
  ["config", "--global", "--unset", checkedOperand("config.unset", "key", key)],
5697
5743
  {
5698
- signal: _optionalChain([opts, 'optionalAccess', _904 => _904.signal])
5744
+ signal: _optionalChain([opts, 'optionalAccess', _905 => _905.signal])
5699
5745
  }
5700
5746
  );
5701
5747
  }
@@ -5707,12 +5753,12 @@ var GitImpl = (_class3 = class {
5707
5753
  */
5708
5754
  async configSetRaw(key, value, opts) {
5709
5755
  const args = ["config", "--global"];
5710
- if (_optionalChain([opts, 'optionalAccess', _905 => _905.add])) {
5756
+ if (_optionalChain([opts, 'optionalAccess', _906 => _906.add])) {
5711
5757
  args.push("--add");
5712
5758
  }
5713
5759
  args.push("--", checkedOperand("config.setRaw", "key", key), value);
5714
5760
  await this.runner.runOrThrow({ type: "global" }, args, {
5715
- signal: _optionalChain([opts, 'optionalAccess', _906 => _906.signal])
5761
+ signal: _optionalChain([opts, 'optionalAccess', _907 => _907.signal])
5716
5762
  });
5717
5763
  }
5718
5764
  /**
@@ -5723,7 +5769,7 @@ var GitImpl = (_class3 = class {
5723
5769
  { type: "global" },
5724
5770
  ["config", "--global", "--unset", checkedOperand("config.unsetRaw", "key", key)],
5725
5771
  {
5726
- signal: _optionalChain([opts, 'optionalAccess', _907 => _907.signal])
5772
+ signal: _optionalChain([opts, 'optionalAccess', _908 => _908.signal])
5727
5773
  }
5728
5774
  );
5729
5775
  }
@@ -5741,23 +5787,23 @@ var GitImpl = (_class3 = class {
5741
5787
  */
5742
5788
  async lfsInstall(opts) {
5743
5789
  const args = ["lfs", "install"];
5744
- if (_optionalChain([opts, 'optionalAccess', _908 => _908.force])) {
5790
+ if (_optionalChain([opts, 'optionalAccess', _909 => _909.force])) {
5745
5791
  args.push("--force");
5746
5792
  }
5747
- if (_optionalChain([opts, 'optionalAccess', _909 => _909.system])) {
5793
+ if (_optionalChain([opts, 'optionalAccess', _910 => _910.system])) {
5748
5794
  args.push("--system");
5749
5795
  }
5750
- if (_optionalChain([opts, 'optionalAccess', _910 => _910.skipSmudge])) {
5796
+ if (_optionalChain([opts, 'optionalAccess', _911 => _911.skipSmudge])) {
5751
5797
  args.push("--skip-smudge");
5752
5798
  }
5753
- if (_optionalChain([opts, 'optionalAccess', _911 => _911.skipRepo])) {
5799
+ if (_optionalChain([opts, 'optionalAccess', _912 => _912.skipRepo])) {
5754
5800
  args.push("--skip-repo");
5755
5801
  }
5756
- if (_optionalChain([opts, 'optionalAccess', _912 => _912.manual])) {
5802
+ if (_optionalChain([opts, 'optionalAccess', _913 => _913.manual])) {
5757
5803
  args.push("--manual");
5758
5804
  }
5759
5805
  await this.runner.runOrThrow({ type: "global" }, args, {
5760
- signal: _optionalChain([opts, 'optionalAccess', _913 => _913.signal])
5806
+ signal: _optionalChain([opts, 'optionalAccess', _914 => _914.signal])
5761
5807
  });
5762
5808
  }
5763
5809
  /**
@@ -5765,14 +5811,14 @@ var GitImpl = (_class3 = class {
5765
5811
  */
5766
5812
  async lfsUninstall(opts) {
5767
5813
  const args = ["lfs", "uninstall"];
5768
- if (_optionalChain([opts, 'optionalAccess', _914 => _914.system])) {
5814
+ if (_optionalChain([opts, 'optionalAccess', _915 => _915.system])) {
5769
5815
  args.push("--system");
5770
5816
  }
5771
- if (_optionalChain([opts, 'optionalAccess', _915 => _915.skipRepo])) {
5817
+ if (_optionalChain([opts, 'optionalAccess', _916 => _916.skipRepo])) {
5772
5818
  args.push("--skip-repo");
5773
5819
  }
5774
5820
  await this.runner.runOrThrow({ type: "global" }, args, {
5775
- signal: _optionalChain([opts, 'optionalAccess', _916 => _916.signal])
5821
+ signal: _optionalChain([opts, 'optionalAccess', _917 => _917.signal])
5776
5822
  });
5777
5823
  }
5778
5824
  /**
@@ -5780,7 +5826,7 @@ var GitImpl = (_class3 = class {
5780
5826
  */
5781
5827
  async lfsVersion(opts) {
5782
5828
  const result = await this.runner.runOrThrow({ type: "global" }, ["lfs", "version"], {
5783
- signal: _optionalChain([opts, 'optionalAccess', _917 => _917.signal])
5829
+ signal: _optionalChain([opts, 'optionalAccess', _918 => _918.signal])
5784
5830
  });
5785
5831
  return result.stdout.trim();
5786
5832
  }
@@ -5794,7 +5840,7 @@ async function createGit(options) {
5794
5840
  const versionString = await git.version();
5795
5841
  const minVersion = options.useLegacyVersion ? LEGACY_GIT_VERSION : MIN_GIT_VERSION;
5796
5842
  if (compareVersions(versionString, minVersion) < 0) {
5797
- throw new (0, _chunk6HDMSFY7cjs.GitError)(
5843
+ throw new (0, _chunkRWKMVYO5cjs.GitError)(
5798
5844
  "UnsupportedGitVersion",
5799
5845
  `Git version ${versionString} is not supported. Minimum required version is ${minVersion}.`,
5800
5846
  {}
@@ -5808,7 +5854,7 @@ async function createGit(options) {
5808
5854
  var GitClient = class {
5809
5855
  constructor(git) {
5810
5856
  this.git = git;
5811
- _chunk6HDMSFY7cjs.registerCommandHost.call(void 0, this, () => _chunk6HDMSFY7cjs.commandHostOf.call(void 0, git));
5857
+ _chunkRWKMVYO5cjs.registerCommandHost.call(void 0, this, () => _chunkRWKMVYO5cjs.commandHostOf.call(void 0, git));
5812
5858
  }
5813
5859
  get open() {
5814
5860
  return this.git.open.bind(this.git);
@@ -5918,7 +5964,7 @@ async function runTailPolling(options) {
5918
5964
  const { adapter, signal, pollInterval = 100, onLine } = options;
5919
5965
  let position = 0;
5920
5966
  let buffer = "";
5921
- while (!_optionalChain([signal, 'optionalAccess', _918 => _918.aborted])) {
5967
+ while (!_optionalChain([signal, 'optionalAccess', _919 => _919.aborted])) {
5922
5968
  const result = await adapter.readChunk(position);
5923
5969
  if (result !== null && result.data.length > 0) {
5924
5970
  position = result.newPosition;
@@ -5931,7 +5977,7 @@ async function runTailPolling(options) {
5931
5977
  }
5932
5978
  }
5933
5979
  }
5934
- if (!_optionalChain([signal, 'optionalAccess', _919 => _919.aborted])) {
5980
+ if (!_optionalChain([signal, 'optionalAccess', _920 => _920.aborted])) {
5935
5981
  await adapter.sleep(pollInterval);
5936
5982
  }
5937
5983
  }
@@ -5986,7 +6032,7 @@ function createTailPolling(options) {
5986
6032
  async function startPollingLoop(adapter, state, signal, pollInterval, stop) {
5987
6033
  let position = 0;
5988
6034
  let buffer = "";
5989
- while (!(state.stopped || _optionalChain([signal, 'optionalAccess', _920 => _920.aborted]))) {
6035
+ while (!(state.stopped || _optionalChain([signal, 'optionalAccess', _921 => _921.aborted]))) {
5990
6036
  const result = await adapter.readChunk(position);
5991
6037
  if (result !== null && result.data.length > 0) {
5992
6038
  position = result.newPosition;
@@ -6005,7 +6051,7 @@ async function startPollingLoop(adapter, state, signal, pollInterval, stop) {
6005
6051
  }
6006
6052
  }
6007
6053
  }
6008
- if (state.stopped || _optionalChain([signal, 'optionalAccess', _921 => _921.aborted])) {
6054
+ if (state.stopped || _optionalChain([signal, 'optionalAccess', _922 => _922.aborted])) {
6009
6055
  break;
6010
6056
  }
6011
6057
  await adapter.sleep(pollInterval);