type-git 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/dist/adapters/node/index.d.ts +67 -5
- package/dist/adapters/node/index.d.ts.map +1 -1
- package/dist/adapters/node/index.js +54 -7
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/core/git.d.ts +280 -14
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/repo.d.ts +1738 -48
- package/dist/core/repo.d.ts.map +1 -1
- package/dist/core/types.d.ts +5 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/impl/bare-repo-impl.d.ts +19 -0
- package/dist/impl/bare-repo-impl.d.ts.map +1 -1
- package/dist/impl/bare-repo-impl.js +123 -5
- package/dist/impl/bare-repo-impl.js.map +1 -1
- package/dist/impl/git-impl.d.ts +38 -5
- package/dist/impl/git-impl.d.ts.map +1 -1
- package/dist/impl/git-impl.js +221 -17
- package/dist/impl/git-impl.js.map +1 -1
- package/dist/impl/worktree-repo-impl.d.ts +48 -2
- package/dist/impl/worktree-repo-impl.d.ts.map +1 -1
- package/dist/impl/worktree-repo-impl.js +1984 -28
- package/dist/impl/worktree-repo-impl.js.map +1 -1
- package/package.json +7 -2
|
@@ -30,6 +30,22 @@ export class WorktreeRepoImpl {
|
|
|
30
30
|
push: this.lfsPush.bind(this),
|
|
31
31
|
status: this.lfsStatus.bind(this),
|
|
32
32
|
prune: this.lfsPrune.bind(this),
|
|
33
|
+
fetch: this.lfsFetch.bind(this),
|
|
34
|
+
install: this.lfsInstall.bind(this),
|
|
35
|
+
uninstall: this.lfsUninstall.bind(this),
|
|
36
|
+
lsFiles: this.lfsLsFiles.bind(this),
|
|
37
|
+
track: this.lfsTrack.bind(this),
|
|
38
|
+
trackList: this.lfsTrackList.bind(this),
|
|
39
|
+
untrack: this.lfsUntrack.bind(this),
|
|
40
|
+
lock: this.lfsLock.bind(this),
|
|
41
|
+
unlock: this.lfsUnlock.bind(this),
|
|
42
|
+
locks: this.lfsLocks.bind(this),
|
|
43
|
+
checkout: this.lfsCheckout.bind(this),
|
|
44
|
+
migrateInfo: this.lfsMigrateInfo.bind(this),
|
|
45
|
+
migrateImport: this.lfsMigrateImport.bind(this),
|
|
46
|
+
migrateExport: this.lfsMigrateExport.bind(this),
|
|
47
|
+
env: this.lfsEnv.bind(this),
|
|
48
|
+
version: this.lfsVersion.bind(this),
|
|
33
49
|
};
|
|
34
50
|
// Initialize LFS extra operations
|
|
35
51
|
this.lfsExtra = {
|
|
@@ -44,6 +60,8 @@ export class WorktreeRepoImpl {
|
|
|
44
60
|
prune: this.worktreePrune.bind(this),
|
|
45
61
|
lock: this.worktreeLock.bind(this),
|
|
46
62
|
unlock: this.worktreeUnlock.bind(this),
|
|
63
|
+
move: this.worktreeMove.bind(this),
|
|
64
|
+
repair: this.worktreeRepair.bind(this),
|
|
47
65
|
};
|
|
48
66
|
// Initialize branch operations
|
|
49
67
|
this.branch = {
|
|
@@ -76,6 +94,13 @@ export class WorktreeRepoImpl {
|
|
|
76
94
|
update: this.submoduleUpdate.bind(this),
|
|
77
95
|
add: this.submoduleAdd.bind(this),
|
|
78
96
|
deinit: this.submoduleDeinit.bind(this),
|
|
97
|
+
status: this.submoduleStatus.bind(this),
|
|
98
|
+
summary: this.submoduleSummary.bind(this),
|
|
99
|
+
foreach: this.submoduleForeach.bind(this),
|
|
100
|
+
sync: this.submoduleSync.bind(this),
|
|
101
|
+
absorbGitDirs: this.submoduleAbsorbGitDirs.bind(this),
|
|
102
|
+
setBranch: this.submoduleSetBranch.bind(this),
|
|
103
|
+
setUrl: this.submoduleSetUrl.bind(this),
|
|
79
104
|
};
|
|
80
105
|
// Initialize remote operations
|
|
81
106
|
this.remote = {
|
|
@@ -85,6 +110,11 @@ export class WorktreeRepoImpl {
|
|
|
85
110
|
rename: this.remoteRename.bind(this),
|
|
86
111
|
getUrl: this.remoteGetUrl.bind(this),
|
|
87
112
|
setUrl: this.remoteSetUrl.bind(this),
|
|
113
|
+
setHead: this.remoteSetHead.bind(this),
|
|
114
|
+
show: this.remoteShow.bind(this),
|
|
115
|
+
prune: this.remotePrune.bind(this),
|
|
116
|
+
update: this.remoteUpdate.bind(this),
|
|
117
|
+
setBranches: this.remoteSetBranches.bind(this),
|
|
88
118
|
};
|
|
89
119
|
// Initialize config operations (repository-level)
|
|
90
120
|
this.config = {
|
|
@@ -97,6 +127,8 @@ export class WorktreeRepoImpl {
|
|
|
97
127
|
setRaw: this.configSetRaw.bind(this),
|
|
98
128
|
unsetRaw: this.configUnsetRaw.bind(this),
|
|
99
129
|
list: this.configList.bind(this),
|
|
130
|
+
renameSection: this.configRenameSection.bind(this),
|
|
131
|
+
removeSection: this.configRemoveSection.bind(this),
|
|
100
132
|
};
|
|
101
133
|
}
|
|
102
134
|
get context() {
|
|
@@ -108,11 +140,34 @@ export class WorktreeRepoImpl {
|
|
|
108
140
|
async raw(argv, opts) {
|
|
109
141
|
return this.runner.run(this.context, argv, opts);
|
|
110
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Check if this repository is a worktree repository (has working directory)
|
|
145
|
+
*
|
|
146
|
+
* For WorktreeRepoImpl, this returns the actual state from git.
|
|
147
|
+
*/
|
|
148
|
+
async isWorktree() {
|
|
149
|
+
const result = await this.runner.run(this.context, ['rev-parse', '--is-inside-work-tree']);
|
|
150
|
+
return result.exitCode === 0 && result.stdout.trim() === 'true';
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Check if this repository is a bare repository (no working directory)
|
|
154
|
+
*
|
|
155
|
+
* For WorktreeRepoImpl, this queries git and returns the actual state.
|
|
156
|
+
*/
|
|
157
|
+
async isBare() {
|
|
158
|
+
const result = await this.runner.run(this.context, ['rev-parse', '--is-bare-repository']);
|
|
159
|
+
return result.exitCode === 0 && result.stdout.trim() === 'true';
|
|
160
|
+
}
|
|
111
161
|
/**
|
|
112
162
|
* Get repository status
|
|
113
163
|
*/
|
|
114
164
|
async status(opts) {
|
|
115
165
|
const args = ['status', '--porcelain=v2'];
|
|
166
|
+
// Verbosity options
|
|
167
|
+
if (opts?.verbose) {
|
|
168
|
+
args.push('--verbose');
|
|
169
|
+
}
|
|
170
|
+
// Untracked files handling
|
|
116
171
|
if (opts?.untracked) {
|
|
117
172
|
switch (opts.untracked) {
|
|
118
173
|
case 'no':
|
|
@@ -128,6 +183,48 @@ export class WorktreeRepoImpl {
|
|
|
128
183
|
}
|
|
129
184
|
// Add branch info
|
|
130
185
|
args.push('--branch');
|
|
186
|
+
// Show stash information
|
|
187
|
+
if (opts?.showStash) {
|
|
188
|
+
args.push('--show-stash');
|
|
189
|
+
}
|
|
190
|
+
// Ahead/behind tracking
|
|
191
|
+
if (opts?.aheadBehind === false) {
|
|
192
|
+
args.push('--no-ahead-behind');
|
|
193
|
+
}
|
|
194
|
+
// NUL terminator
|
|
195
|
+
if (opts?.nullTerminated) {
|
|
196
|
+
args.push('-z');
|
|
197
|
+
}
|
|
198
|
+
// Ignored files handling
|
|
199
|
+
if (opts?.ignored) {
|
|
200
|
+
switch (opts.ignored) {
|
|
201
|
+
case 'traditional':
|
|
202
|
+
args.push('--ignored=traditional');
|
|
203
|
+
break;
|
|
204
|
+
case 'no':
|
|
205
|
+
args.push('--ignored=no');
|
|
206
|
+
break;
|
|
207
|
+
case 'matching':
|
|
208
|
+
args.push('--ignored=matching');
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Submodule handling
|
|
213
|
+
if (opts?.ignoreSubmodules) {
|
|
214
|
+
args.push(`--ignore-submodules=${opts.ignoreSubmodules}`);
|
|
215
|
+
}
|
|
216
|
+
// Rename detection
|
|
217
|
+
if (opts?.noRenames) {
|
|
218
|
+
args.push('--no-renames');
|
|
219
|
+
}
|
|
220
|
+
else if (opts?.findRenames !== undefined) {
|
|
221
|
+
if (opts.findRenames === true) {
|
|
222
|
+
args.push('--find-renames');
|
|
223
|
+
}
|
|
224
|
+
else if (typeof opts.findRenames === 'number') {
|
|
225
|
+
args.push(`--find-renames=${opts.findRenames}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
131
228
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
132
229
|
signal: opts?.signal,
|
|
133
230
|
});
|
|
@@ -225,14 +322,23 @@ export class WorktreeRepoImpl {
|
|
|
225
322
|
if (opts?.skip !== undefined) {
|
|
226
323
|
args.push(`--skip=${opts.skip}`);
|
|
227
324
|
}
|
|
325
|
+
// Date filters (since/after and until/before are aliases)
|
|
228
326
|
if (opts?.since) {
|
|
229
327
|
const since = opts.since instanceof Date ? opts.since.toISOString() : opts.since;
|
|
230
328
|
args.push(`--since=${since}`);
|
|
231
329
|
}
|
|
330
|
+
else if (opts?.after) {
|
|
331
|
+
const after = opts.after instanceof Date ? opts.after.toISOString() : opts.after;
|
|
332
|
+
args.push(`--after=${after}`);
|
|
333
|
+
}
|
|
232
334
|
if (opts?.until) {
|
|
233
335
|
const until = opts.until instanceof Date ? opts.until.toISOString() : opts.until;
|
|
234
336
|
args.push(`--until=${until}`);
|
|
235
337
|
}
|
|
338
|
+
else if (opts?.before) {
|
|
339
|
+
const before = opts.before instanceof Date ? opts.before.toISOString() : opts.before;
|
|
340
|
+
args.push(`--before=${before}`);
|
|
341
|
+
}
|
|
236
342
|
if (opts?.author) {
|
|
237
343
|
args.push(`--author=${opts.author}`);
|
|
238
344
|
}
|
|
@@ -245,6 +351,50 @@ export class WorktreeRepoImpl {
|
|
|
245
351
|
if (opts?.firstParent) {
|
|
246
352
|
args.push('--first-parent');
|
|
247
353
|
}
|
|
354
|
+
// New options
|
|
355
|
+
if (opts?.source) {
|
|
356
|
+
args.push('--source');
|
|
357
|
+
}
|
|
358
|
+
if (opts?.useMailmap) {
|
|
359
|
+
args.push('--use-mailmap');
|
|
360
|
+
}
|
|
361
|
+
if (opts?.decorateRefs) {
|
|
362
|
+
args.push(`--decorate-refs=${opts.decorateRefs}`);
|
|
363
|
+
}
|
|
364
|
+
if (opts?.decorateRefsExclude) {
|
|
365
|
+
args.push(`--decorate-refs-exclude=${opts.decorateRefsExclude}`);
|
|
366
|
+
}
|
|
367
|
+
if (opts?.decorate) {
|
|
368
|
+
args.push(`--decorate=${opts.decorate}`);
|
|
369
|
+
}
|
|
370
|
+
if (opts?.stat) {
|
|
371
|
+
args.push('--stat');
|
|
372
|
+
}
|
|
373
|
+
if (opts?.shortstat) {
|
|
374
|
+
args.push('--shortstat');
|
|
375
|
+
}
|
|
376
|
+
if (opts?.nameOnly) {
|
|
377
|
+
args.push('--name-only');
|
|
378
|
+
}
|
|
379
|
+
if (opts?.nameStatus) {
|
|
380
|
+
args.push('--name-status');
|
|
381
|
+
}
|
|
382
|
+
if (opts?.merges) {
|
|
383
|
+
args.push('--merges');
|
|
384
|
+
}
|
|
385
|
+
if (opts?.noMerges) {
|
|
386
|
+
args.push('--no-merges');
|
|
387
|
+
}
|
|
388
|
+
if (opts?.ancestryPath) {
|
|
389
|
+
args.push('--ancestry-path');
|
|
390
|
+
}
|
|
391
|
+
if (opts?.reverse) {
|
|
392
|
+
args.push('--reverse');
|
|
393
|
+
}
|
|
394
|
+
// ref must be placed after all options (positional argument)
|
|
395
|
+
if (opts?.ref) {
|
|
396
|
+
args.push(opts.ref);
|
|
397
|
+
}
|
|
248
398
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
249
399
|
signal: opts?.signal,
|
|
250
400
|
});
|
|
@@ -272,18 +422,145 @@ export class WorktreeRepoImpl {
|
|
|
272
422
|
*/
|
|
273
423
|
async fetch(opts) {
|
|
274
424
|
const args = ['fetch'];
|
|
425
|
+
// Progress tracking
|
|
275
426
|
if (opts?.onProgress) {
|
|
276
427
|
args.push('--progress');
|
|
277
428
|
}
|
|
429
|
+
// Verbosity options
|
|
430
|
+
if (opts?.verbose) {
|
|
431
|
+
args.push('--verbose');
|
|
432
|
+
}
|
|
433
|
+
if (opts?.quiet) {
|
|
434
|
+
args.push('--quiet');
|
|
435
|
+
}
|
|
436
|
+
// Fetch from all remotes
|
|
437
|
+
if (opts?.all) {
|
|
438
|
+
args.push('--all');
|
|
439
|
+
}
|
|
440
|
+
// Set upstream tracking
|
|
441
|
+
if (opts?.setUpstream) {
|
|
442
|
+
args.push('--set-upstream');
|
|
443
|
+
}
|
|
444
|
+
// Append to FETCH_HEAD
|
|
445
|
+
if (opts?.append) {
|
|
446
|
+
args.push('--append');
|
|
447
|
+
}
|
|
448
|
+
// Atomic transaction
|
|
449
|
+
if (opts?.atomic) {
|
|
450
|
+
args.push('--atomic');
|
|
451
|
+
}
|
|
452
|
+
// Force update
|
|
453
|
+
if (opts?.force) {
|
|
454
|
+
args.push('--force');
|
|
455
|
+
}
|
|
456
|
+
// Multiple remotes
|
|
457
|
+
if (opts?.multiple) {
|
|
458
|
+
args.push('--multiple');
|
|
459
|
+
}
|
|
460
|
+
// Prune options
|
|
278
461
|
if (opts?.prune) {
|
|
279
462
|
args.push('--prune');
|
|
280
463
|
}
|
|
464
|
+
if (opts?.pruneTags) {
|
|
465
|
+
args.push('--prune-tags');
|
|
466
|
+
}
|
|
467
|
+
// Tag handling
|
|
281
468
|
if (opts?.tags) {
|
|
282
469
|
args.push('--tags');
|
|
283
470
|
}
|
|
471
|
+
else if (opts?.noTags) {
|
|
472
|
+
args.push('--no-tags');
|
|
473
|
+
}
|
|
474
|
+
// Parallel jobs for submodules
|
|
475
|
+
if (opts?.jobs !== undefined) {
|
|
476
|
+
args.push(`--jobs=${opts.jobs}`);
|
|
477
|
+
}
|
|
478
|
+
// Prefetch mode
|
|
479
|
+
if (opts?.prefetch) {
|
|
480
|
+
args.push('--prefetch');
|
|
481
|
+
}
|
|
482
|
+
// Submodule recursion
|
|
483
|
+
if (opts?.recurseSubmodules !== undefined) {
|
|
484
|
+
if (opts.recurseSubmodules === true || opts.recurseSubmodules === 'yes') {
|
|
485
|
+
args.push('--recurse-submodules=yes');
|
|
486
|
+
}
|
|
487
|
+
else if (opts.recurseSubmodules === 'on-demand') {
|
|
488
|
+
args.push('--recurse-submodules=on-demand');
|
|
489
|
+
}
|
|
490
|
+
else if (opts.recurseSubmodules === 'no' || opts.recurseSubmodules === false) {
|
|
491
|
+
args.push('--recurse-submodules=no');
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
// Dry run
|
|
495
|
+
if (opts?.dryRun) {
|
|
496
|
+
args.push('--dry-run');
|
|
497
|
+
}
|
|
498
|
+
// FETCH_HEAD writing
|
|
499
|
+
if (opts?.writeFetchHead === false) {
|
|
500
|
+
args.push('--no-write-fetch-head');
|
|
501
|
+
}
|
|
502
|
+
// Keep downloaded pack
|
|
503
|
+
if (opts?.keep) {
|
|
504
|
+
args.push('--keep');
|
|
505
|
+
}
|
|
506
|
+
// Update head
|
|
507
|
+
if (opts?.updateHeadOk) {
|
|
508
|
+
args.push('--update-head-ok');
|
|
509
|
+
}
|
|
510
|
+
// Shallow clone options
|
|
284
511
|
if (opts?.depth !== undefined) {
|
|
285
512
|
args.push(`--depth=${opts.depth}`);
|
|
286
513
|
}
|
|
514
|
+
if (opts?.shallowSince) {
|
|
515
|
+
const since = opts.shallowSince instanceof Date ? opts.shallowSince.toISOString() : opts.shallowSince;
|
|
516
|
+
args.push(`--shallow-since=${since}`);
|
|
517
|
+
}
|
|
518
|
+
if (opts?.shallowExclude) {
|
|
519
|
+
const excludes = Array.isArray(opts.shallowExclude)
|
|
520
|
+
? opts.shallowExclude
|
|
521
|
+
: [opts.shallowExclude];
|
|
522
|
+
for (const exclude of excludes) {
|
|
523
|
+
args.push(`--shallow-exclude=${exclude}`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (opts?.deepen !== undefined) {
|
|
527
|
+
args.push(`--deepen=${opts.deepen}`);
|
|
528
|
+
}
|
|
529
|
+
if (opts?.unshallow) {
|
|
530
|
+
args.push('--unshallow');
|
|
531
|
+
}
|
|
532
|
+
// Refetch all objects
|
|
533
|
+
if (opts?.refetch) {
|
|
534
|
+
args.push('--refetch');
|
|
535
|
+
}
|
|
536
|
+
// Update shallow boundary
|
|
537
|
+
if (opts?.updateShallow) {
|
|
538
|
+
args.push('--update-shallow');
|
|
539
|
+
}
|
|
540
|
+
// Refmap override
|
|
541
|
+
if (opts?.refmap) {
|
|
542
|
+
args.push(`--refmap=${opts.refmap}`);
|
|
543
|
+
}
|
|
544
|
+
// Network options
|
|
545
|
+
if (opts?.ipv4) {
|
|
546
|
+
args.push('--ipv4');
|
|
547
|
+
}
|
|
548
|
+
if (opts?.ipv6) {
|
|
549
|
+
args.push('--ipv6');
|
|
550
|
+
}
|
|
551
|
+
// Partial clone filter
|
|
552
|
+
if (opts?.filter) {
|
|
553
|
+
args.push(`--filter=${opts.filter}`);
|
|
554
|
+
}
|
|
555
|
+
// Show forced updates
|
|
556
|
+
if (opts?.showForcedUpdates === false) {
|
|
557
|
+
args.push('--no-show-forced-updates');
|
|
558
|
+
}
|
|
559
|
+
// Write commit graph
|
|
560
|
+
if (opts?.writeCommitGraph) {
|
|
561
|
+
args.push('--write-commit-graph');
|
|
562
|
+
}
|
|
563
|
+
// Remote and refspec (must be last)
|
|
287
564
|
if (opts?.remote) {
|
|
288
565
|
args.push(opts.remote);
|
|
289
566
|
}
|
|
@@ -301,9 +578,37 @@ export class WorktreeRepoImpl {
|
|
|
301
578
|
*/
|
|
302
579
|
async push(opts) {
|
|
303
580
|
const args = ['push'];
|
|
581
|
+
// Progress tracking
|
|
304
582
|
if (opts?.onProgress) {
|
|
305
583
|
args.push('--progress');
|
|
306
584
|
}
|
|
585
|
+
// Verbosity options
|
|
586
|
+
if (opts?.verbose) {
|
|
587
|
+
args.push('--verbose');
|
|
588
|
+
}
|
|
589
|
+
if (opts?.quiet) {
|
|
590
|
+
args.push('--quiet');
|
|
591
|
+
}
|
|
592
|
+
// Repository override
|
|
593
|
+
if (opts?.repo) {
|
|
594
|
+
args.push(`--repo=${opts.repo}`);
|
|
595
|
+
}
|
|
596
|
+
// Push all branches
|
|
597
|
+
if (opts?.all) {
|
|
598
|
+
args.push('--all');
|
|
599
|
+
}
|
|
600
|
+
else if (opts?.branches) {
|
|
601
|
+
args.push('--branches');
|
|
602
|
+
}
|
|
603
|
+
// Mirror mode
|
|
604
|
+
if (opts?.mirror) {
|
|
605
|
+
args.push('--mirror');
|
|
606
|
+
}
|
|
607
|
+
// Delete refs
|
|
608
|
+
if (opts?.deleteRefs) {
|
|
609
|
+
args.push('--delete');
|
|
610
|
+
}
|
|
611
|
+
// Force options
|
|
307
612
|
if (opts?.force) {
|
|
308
613
|
args.push('--force');
|
|
309
614
|
}
|
|
@@ -322,15 +627,52 @@ export class WorktreeRepoImpl {
|
|
|
322
627
|
}
|
|
323
628
|
}
|
|
324
629
|
}
|
|
630
|
+
if (opts?.forceIfIncludes) {
|
|
631
|
+
args.push('--force-if-includes');
|
|
632
|
+
}
|
|
633
|
+
// Dry run
|
|
634
|
+
if (opts?.dryRun) {
|
|
635
|
+
args.push('--dry-run');
|
|
636
|
+
}
|
|
637
|
+
// Submodule recursion
|
|
638
|
+
if (opts?.recurseSubmodules) {
|
|
639
|
+
args.push(`--recurse-submodules=${opts.recurseSubmodules}`);
|
|
640
|
+
}
|
|
641
|
+
// Thin pack
|
|
642
|
+
if (opts?.thin === false) {
|
|
643
|
+
args.push('--no-thin');
|
|
644
|
+
}
|
|
645
|
+
// Prune remote-tracking branches
|
|
646
|
+
if (opts?.prune) {
|
|
647
|
+
args.push('--prune');
|
|
648
|
+
}
|
|
649
|
+
// Tag handling
|
|
325
650
|
if (opts?.tags) {
|
|
326
651
|
args.push('--tags');
|
|
327
652
|
}
|
|
653
|
+
if (opts?.followTags) {
|
|
654
|
+
args.push('--follow-tags');
|
|
655
|
+
}
|
|
656
|
+
// Atomic transaction
|
|
657
|
+
if (opts?.atomic) {
|
|
658
|
+
args.push('--atomic');
|
|
659
|
+
}
|
|
660
|
+
// Push options
|
|
661
|
+
if (opts?.pushOption) {
|
|
662
|
+
const pushOptions = Array.isArray(opts.pushOption) ? opts.pushOption : [opts.pushOption];
|
|
663
|
+
for (const opt of pushOptions) {
|
|
664
|
+
args.push('--push-option', opt);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
// Set upstream tracking
|
|
328
668
|
if (opts?.setUpstream) {
|
|
329
669
|
args.push('--set-upstream');
|
|
330
670
|
}
|
|
671
|
+
// Bypass pre-push hook
|
|
331
672
|
if (opts?.noVerify) {
|
|
332
673
|
args.push('--no-verify');
|
|
333
674
|
}
|
|
675
|
+
// GPG signing
|
|
334
676
|
if (opts?.signed !== undefined) {
|
|
335
677
|
if (opts.signed === true) {
|
|
336
678
|
args.push('--signed');
|
|
@@ -339,6 +681,14 @@ export class WorktreeRepoImpl {
|
|
|
339
681
|
args.push('--signed=if-asked');
|
|
340
682
|
}
|
|
341
683
|
}
|
|
684
|
+
// Network options
|
|
685
|
+
if (opts?.ipv4) {
|
|
686
|
+
args.push('--ipv4');
|
|
687
|
+
}
|
|
688
|
+
if (opts?.ipv6) {
|
|
689
|
+
args.push('--ipv6');
|
|
690
|
+
}
|
|
691
|
+
// Remote and refspec (must be last)
|
|
342
692
|
if (opts?.remote) {
|
|
343
693
|
args.push(opts.remote);
|
|
344
694
|
}
|
|
@@ -386,7 +736,20 @@ export class WorktreeRepoImpl {
|
|
|
386
736
|
if (this._lfsMode === 'disabled') {
|
|
387
737
|
return;
|
|
388
738
|
}
|
|
389
|
-
const args = ['lfs', 'push'
|
|
739
|
+
const args = ['lfs', 'push'];
|
|
740
|
+
if (opts?.dryRun) {
|
|
741
|
+
args.push('--dry-run');
|
|
742
|
+
}
|
|
743
|
+
if (opts?.objectId) {
|
|
744
|
+
const oids = Array.isArray(opts.objectId) ? opts.objectId : [opts.objectId];
|
|
745
|
+
for (const oid of oids) {
|
|
746
|
+
args.push('--object-id', oid);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
// Default to --all if not pushing specific objects
|
|
751
|
+
args.push('--all');
|
|
752
|
+
}
|
|
390
753
|
if (opts?.remote) {
|
|
391
754
|
args.push(opts.remote);
|
|
392
755
|
}
|
|
@@ -406,6 +769,9 @@ export class WorktreeRepoImpl {
|
|
|
406
769
|
if (opts?.json) {
|
|
407
770
|
args.push('--json');
|
|
408
771
|
}
|
|
772
|
+
if (opts?.porcelain) {
|
|
773
|
+
args.push('--porcelain');
|
|
774
|
+
}
|
|
409
775
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
410
776
|
signal: opts?.signal,
|
|
411
777
|
});
|
|
@@ -616,10 +982,488 @@ export class WorktreeRepoImpl {
|
|
|
616
982
|
if (opts?.verifyUnreferenced) {
|
|
617
983
|
args.push('--verify-unreferenced');
|
|
618
984
|
}
|
|
619
|
-
|
|
985
|
+
if (opts?.recent) {
|
|
986
|
+
args.push('--recent');
|
|
987
|
+
}
|
|
988
|
+
if (opts?.verbose) {
|
|
989
|
+
args.push('--verbose');
|
|
990
|
+
}
|
|
991
|
+
if (opts?.whenUnverified) {
|
|
992
|
+
args.push(`--when-unverified=${opts.whenUnverified}`);
|
|
993
|
+
}
|
|
994
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
995
|
+
signal: opts?.signal,
|
|
996
|
+
onProgress: opts?.onProgress,
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
async lfsFetch(opts) {
|
|
1000
|
+
if (this._lfsMode === 'disabled') {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
const args = ['lfs', 'fetch'];
|
|
1004
|
+
if (opts?.onProgress) {
|
|
1005
|
+
args.push('--progress');
|
|
1006
|
+
}
|
|
1007
|
+
if (opts?.all) {
|
|
1008
|
+
args.push('--all');
|
|
1009
|
+
}
|
|
1010
|
+
if (opts?.prune) {
|
|
1011
|
+
args.push('--prune');
|
|
1012
|
+
}
|
|
1013
|
+
if (opts?.recent) {
|
|
1014
|
+
args.push('--recent');
|
|
1015
|
+
}
|
|
1016
|
+
if (opts?.include) {
|
|
1017
|
+
const patterns = Array.isArray(opts.include) ? opts.include : [opts.include];
|
|
1018
|
+
for (const pattern of patterns) {
|
|
1019
|
+
args.push('--include', pattern);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
if (opts?.exclude) {
|
|
1023
|
+
const patterns = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
|
|
1024
|
+
for (const pattern of patterns) {
|
|
1025
|
+
args.push('--exclude', pattern);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
if (opts?.remote) {
|
|
1029
|
+
args.push(opts.remote);
|
|
1030
|
+
}
|
|
1031
|
+
if (opts?.refs) {
|
|
1032
|
+
const refList = Array.isArray(opts.refs) ? opts.refs : [opts.refs];
|
|
1033
|
+
args.push(...refList);
|
|
1034
|
+
}
|
|
1035
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1036
|
+
signal: opts?.signal,
|
|
1037
|
+
onProgress: opts?.onProgress,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
async lfsInstall(opts) {
|
|
1041
|
+
const args = ['lfs', 'install'];
|
|
1042
|
+
if (opts?.force) {
|
|
1043
|
+
args.push('--force');
|
|
1044
|
+
}
|
|
1045
|
+
// Use --worktree if specified, otherwise default to --local
|
|
1046
|
+
if (opts?.worktree) {
|
|
1047
|
+
args.push('--worktree');
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
args.push('--local');
|
|
1051
|
+
}
|
|
1052
|
+
if (opts?.skipSmudge) {
|
|
1053
|
+
args.push('--skip-smudge');
|
|
1054
|
+
}
|
|
1055
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1056
|
+
signal: opts?.signal,
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
async lfsUninstall(opts) {
|
|
1060
|
+
const args = ['lfs', 'uninstall'];
|
|
1061
|
+
// Use --worktree if specified, otherwise default to --local
|
|
1062
|
+
if (opts?.worktree) {
|
|
1063
|
+
args.push('--worktree');
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
args.push('--local');
|
|
1067
|
+
}
|
|
1068
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1069
|
+
signal: opts?.signal,
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
async lfsLsFiles(opts) {
|
|
1073
|
+
if (this._lfsMode === 'disabled') {
|
|
1074
|
+
return [];
|
|
1075
|
+
}
|
|
1076
|
+
const args = ['lfs', 'ls-files'];
|
|
1077
|
+
if (opts?.long) {
|
|
1078
|
+
args.push('--long');
|
|
1079
|
+
}
|
|
1080
|
+
// biome-ignore lint/style/useExplicitLengthCheck: size is a boolean option, not a length property
|
|
1081
|
+
if (opts?.size) {
|
|
1082
|
+
args.push('--size');
|
|
1083
|
+
}
|
|
1084
|
+
if (opts?.debug) {
|
|
1085
|
+
args.push('--debug');
|
|
1086
|
+
}
|
|
1087
|
+
if (opts?.all) {
|
|
1088
|
+
args.push('--all');
|
|
1089
|
+
}
|
|
1090
|
+
if (opts?.deleted) {
|
|
1091
|
+
args.push('--deleted');
|
|
1092
|
+
}
|
|
1093
|
+
if (opts?.include) {
|
|
1094
|
+
const patterns = Array.isArray(opts.include) ? opts.include : [opts.include];
|
|
1095
|
+
for (const pattern of patterns) {
|
|
1096
|
+
args.push('--include', pattern);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
if (opts?.exclude) {
|
|
1100
|
+
const patterns = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
|
|
1101
|
+
for (const pattern of patterns) {
|
|
1102
|
+
args.push('--exclude', pattern);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
if (opts?.ref) {
|
|
1106
|
+
args.push(opts.ref);
|
|
1107
|
+
}
|
|
1108
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1109
|
+
signal: opts?.signal,
|
|
1110
|
+
});
|
|
1111
|
+
const entries = [];
|
|
1112
|
+
for (const line of parseLines(result.stdout)) {
|
|
1113
|
+
// Format: <oid> <status> <filename> [size]
|
|
1114
|
+
// Status: - (not checked out), * (checked out)
|
|
1115
|
+
const match = line.match(/^([0-9a-f]+)\s+([-*])\s+(.+?)(?:\s+\((\d+)\s*(?:B|bytes)?\))?$/);
|
|
1116
|
+
if (match) {
|
|
1117
|
+
entries.push({
|
|
1118
|
+
oid: match[1],
|
|
1119
|
+
path: match[3],
|
|
1120
|
+
size: match[4] ? Number.parseInt(match[4], 10) : undefined,
|
|
1121
|
+
status: match[2] === '*' ? 'checked-out' : 'not-checked-out',
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return entries;
|
|
1126
|
+
}
|
|
1127
|
+
async lfsTrack(patterns, opts) {
|
|
1128
|
+
const args = ['lfs', 'track'];
|
|
1129
|
+
if (opts?.verbose) {
|
|
1130
|
+
args.push('--verbose');
|
|
1131
|
+
}
|
|
1132
|
+
if (opts?.dryRun) {
|
|
1133
|
+
args.push('--dry-run');
|
|
1134
|
+
}
|
|
1135
|
+
if (opts?.lockable) {
|
|
1136
|
+
args.push('--lockable');
|
|
1137
|
+
}
|
|
1138
|
+
if (opts?.noModifyAttrs) {
|
|
1139
|
+
args.push('--no-modify-attrs');
|
|
1140
|
+
}
|
|
1141
|
+
if (opts?.noExcluded) {
|
|
1142
|
+
args.push('--no-excluded');
|
|
1143
|
+
}
|
|
1144
|
+
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
|
1145
|
+
args.push(...patternList);
|
|
1146
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1147
|
+
signal: opts?.signal,
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
async lfsTrackList(opts) {
|
|
1151
|
+
if (this._lfsMode === 'disabled') {
|
|
1152
|
+
return [];
|
|
1153
|
+
}
|
|
1154
|
+
const result = await this.runner.runOrThrow(this.context, ['lfs', 'track'], {
|
|
1155
|
+
signal: opts?.signal,
|
|
1156
|
+
});
|
|
1157
|
+
const entries = [];
|
|
1158
|
+
for (const line of parseLines(result.stdout)) {
|
|
1159
|
+
// Format: "Listing tracked patterns\n *.psd (.gitattributes)\n *.bin (.gitattributes) [lockable]"
|
|
1160
|
+
const match = line.match(/^\s+(\S+)\s+\(([^)]+)\)(?:\s+\[lockable\])?$/);
|
|
1161
|
+
if (match) {
|
|
1162
|
+
entries.push({
|
|
1163
|
+
pattern: match[1],
|
|
1164
|
+
source: match[2],
|
|
1165
|
+
lockable: line.includes('[lockable]'),
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return entries;
|
|
1170
|
+
}
|
|
1171
|
+
async lfsUntrack(patterns, opts) {
|
|
1172
|
+
const args = ['lfs', 'untrack'];
|
|
1173
|
+
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
|
1174
|
+
args.push(...patternList);
|
|
1175
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1176
|
+
signal: opts?.signal,
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
async lfsLock(path, opts) {
|
|
1180
|
+
if (this._lfsMode === 'disabled') {
|
|
1181
|
+
throw new Error('LFS is disabled');
|
|
1182
|
+
}
|
|
1183
|
+
const args = ['lfs', 'lock', '--json'];
|
|
1184
|
+
if (opts?.remote) {
|
|
1185
|
+
args.push('--remote', opts.remote);
|
|
1186
|
+
}
|
|
1187
|
+
args.push(path);
|
|
1188
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1189
|
+
signal: opts?.signal,
|
|
1190
|
+
});
|
|
1191
|
+
const data = JSON.parse(result.stdout);
|
|
1192
|
+
return {
|
|
1193
|
+
id: data.id,
|
|
1194
|
+
path: data.path,
|
|
1195
|
+
owner: { name: data.owner.name },
|
|
1196
|
+
lockedAt: new Date(data.locked_at),
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
async lfsUnlock(pathOrId, opts) {
|
|
1200
|
+
if (this._lfsMode === 'disabled') {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
const args = ['lfs', 'unlock'];
|
|
1204
|
+
if (opts?.id) {
|
|
1205
|
+
args.push('--id');
|
|
1206
|
+
}
|
|
1207
|
+
if (opts?.force) {
|
|
1208
|
+
args.push('--force');
|
|
1209
|
+
}
|
|
1210
|
+
if (opts?.remote) {
|
|
1211
|
+
args.push('--remote', opts.remote);
|
|
1212
|
+
}
|
|
1213
|
+
args.push(pathOrId);
|
|
1214
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1215
|
+
signal: opts?.signal,
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
async lfsLocks(opts) {
|
|
1219
|
+
if (this._lfsMode === 'disabled') {
|
|
1220
|
+
return [];
|
|
1221
|
+
}
|
|
1222
|
+
const args = ['lfs', 'locks', '--json'];
|
|
1223
|
+
if (opts?.remote) {
|
|
1224
|
+
args.push('--remote', opts.remote);
|
|
1225
|
+
}
|
|
1226
|
+
if (opts?.path) {
|
|
1227
|
+
args.push('--path', opts.path);
|
|
1228
|
+
}
|
|
1229
|
+
if (opts?.id) {
|
|
1230
|
+
args.push('--id', opts.id);
|
|
1231
|
+
}
|
|
1232
|
+
if (opts?.local) {
|
|
1233
|
+
args.push('--local');
|
|
1234
|
+
}
|
|
1235
|
+
if (opts?.cached) {
|
|
1236
|
+
args.push('--cached');
|
|
1237
|
+
}
|
|
1238
|
+
if (opts?.limit !== undefined) {
|
|
1239
|
+
args.push('--limit', String(opts.limit));
|
|
1240
|
+
}
|
|
1241
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1242
|
+
signal: opts?.signal,
|
|
1243
|
+
});
|
|
1244
|
+
const data = JSON.parse(result.stdout);
|
|
1245
|
+
return data.map((lock) => ({
|
|
1246
|
+
id: lock.id,
|
|
1247
|
+
path: lock.path,
|
|
1248
|
+
owner: { name: lock.owner.name },
|
|
1249
|
+
lockedAt: new Date(lock.locked_at),
|
|
1250
|
+
}));
|
|
1251
|
+
}
|
|
1252
|
+
async lfsCheckout(patterns, opts) {
|
|
1253
|
+
if (this._lfsMode === 'disabled') {
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
const args = ['lfs', 'checkout'];
|
|
1257
|
+
if (opts?.onProgress) {
|
|
1258
|
+
args.push('--progress');
|
|
1259
|
+
}
|
|
1260
|
+
if (opts?.include) {
|
|
1261
|
+
const includes = Array.isArray(opts.include) ? opts.include : [opts.include];
|
|
1262
|
+
for (const pattern of includes) {
|
|
1263
|
+
args.push('--include', pattern);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
if (opts?.exclude) {
|
|
1267
|
+
const excludes = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
|
|
1268
|
+
for (const pattern of excludes) {
|
|
1269
|
+
args.push('--exclude', pattern);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
if (patterns) {
|
|
1273
|
+
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
|
1274
|
+
args.push(...patternList);
|
|
1275
|
+
}
|
|
1276
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1277
|
+
signal: opts?.signal,
|
|
1278
|
+
onProgress: opts?.onProgress,
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
async lfsMigrateInfo(opts) {
|
|
1282
|
+
if (this._lfsMode === 'disabled') {
|
|
1283
|
+
return '';
|
|
1284
|
+
}
|
|
1285
|
+
const args = ['lfs', 'migrate', 'info'];
|
|
1286
|
+
this.appendMigrateArgs(args, opts);
|
|
1287
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1288
|
+
signal: opts?.signal,
|
|
1289
|
+
});
|
|
1290
|
+
return result.stdout;
|
|
1291
|
+
}
|
|
1292
|
+
async lfsMigrateImport(opts) {
|
|
1293
|
+
if (this._lfsMode === 'disabled') {
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
const args = ['lfs', 'migrate', 'import'];
|
|
1297
|
+
this.appendMigrateArgs(args, opts);
|
|
1298
|
+
if (opts?.noRewrite) {
|
|
1299
|
+
args.push('--no-rewrite');
|
|
1300
|
+
}
|
|
1301
|
+
if (opts?.object) {
|
|
1302
|
+
const objects = Array.isArray(opts.object) ? opts.object : [opts.object];
|
|
1303
|
+
for (const obj of objects) {
|
|
1304
|
+
args.push('--object', obj);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
if (opts?.verbose) {
|
|
1308
|
+
args.push('--verbose');
|
|
1309
|
+
}
|
|
1310
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1311
|
+
signal: opts?.signal,
|
|
1312
|
+
onProgress: opts?.onProgress,
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
async lfsMigrateExport(opts) {
|
|
1316
|
+
if (this._lfsMode === 'disabled') {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const args = ['lfs', 'migrate', 'export'];
|
|
1320
|
+
this.appendMigrateArgs(args, opts);
|
|
1321
|
+
if (opts?.remote) {
|
|
1322
|
+
args.push('--remote', opts.remote);
|
|
1323
|
+
}
|
|
1324
|
+
if (opts?.verbose) {
|
|
1325
|
+
args.push('--verbose');
|
|
1326
|
+
}
|
|
1327
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1328
|
+
signal: opts?.signal,
|
|
1329
|
+
onProgress: opts?.onProgress,
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
appendMigrateArgs(args, opts) {
|
|
1333
|
+
if (opts?.everything) {
|
|
1334
|
+
args.push('--everything');
|
|
1335
|
+
}
|
|
1336
|
+
if (opts?.include) {
|
|
1337
|
+
const patterns = Array.isArray(opts.include) ? opts.include : [opts.include];
|
|
1338
|
+
for (const pattern of patterns) {
|
|
1339
|
+
args.push('--include', pattern);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
if (opts?.exclude) {
|
|
1343
|
+
const patterns = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
|
|
1344
|
+
for (const pattern of patterns) {
|
|
1345
|
+
args.push('--exclude', pattern);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
if (opts?.includeRef) {
|
|
1349
|
+
const refs = Array.isArray(opts.includeRef) ? opts.includeRef : [opts.includeRef];
|
|
1350
|
+
for (const ref of refs) {
|
|
1351
|
+
args.push('--include-ref', ref);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
if (opts?.excludeRef) {
|
|
1355
|
+
const refs = Array.isArray(opts.excludeRef) ? opts.excludeRef : [opts.excludeRef];
|
|
1356
|
+
for (const ref of refs) {
|
|
1357
|
+
args.push('--exclude-ref', ref);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
if (opts?.above !== undefined) {
|
|
1361
|
+
args.push('--above', String(opts.above));
|
|
1362
|
+
}
|
|
1363
|
+
if (opts?.top !== undefined) {
|
|
1364
|
+
args.push('--top', String(opts.top));
|
|
1365
|
+
}
|
|
1366
|
+
if (opts?.skipFetch) {
|
|
1367
|
+
args.push('--skip-fetch');
|
|
1368
|
+
}
|
|
1369
|
+
if (opts?.yesReally) {
|
|
1370
|
+
args.push('--yes');
|
|
1371
|
+
}
|
|
1372
|
+
if (opts?.fixup) {
|
|
1373
|
+
args.push('--fixup');
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
async lfsEnv(opts) {
|
|
1377
|
+
const result = await this.runner.runOrThrow(this.context, ['lfs', 'env'], {
|
|
1378
|
+
signal: opts?.signal,
|
|
1379
|
+
});
|
|
1380
|
+
const info = {
|
|
1381
|
+
gitVersion: '',
|
|
1382
|
+
lfsVersion: '',
|
|
1383
|
+
endpoint: '',
|
|
1384
|
+
};
|
|
1385
|
+
for (const line of parseLines(result.stdout)) {
|
|
1386
|
+
if (line.startsWith('git version')) {
|
|
1387
|
+
info.gitVersion = line.replace('git version ', '').trim();
|
|
1388
|
+
}
|
|
1389
|
+
else if (line.startsWith('git-lfs/')) {
|
|
1390
|
+
info.lfsVersion = line.split(' ')[0]?.replace('git-lfs/', '') ?? '';
|
|
1391
|
+
}
|
|
1392
|
+
else if (line.startsWith('Endpoint=')) {
|
|
1393
|
+
info.endpoint = line.replace('Endpoint=', '').trim();
|
|
1394
|
+
}
|
|
1395
|
+
else if (line.startsWith(' SSH=')) {
|
|
1396
|
+
info.sshEndpoint = line.replace(' SSH=', '').trim();
|
|
1397
|
+
}
|
|
1398
|
+
else if (line.startsWith('LocalWorkingDir=')) {
|
|
1399
|
+
info.localWorkingDir = line.replace('LocalWorkingDir=', '').trim();
|
|
1400
|
+
}
|
|
1401
|
+
else if (line.startsWith('LocalGitDir=')) {
|
|
1402
|
+
info.localGitDir = line.replace('LocalGitDir=', '').trim();
|
|
1403
|
+
}
|
|
1404
|
+
else if (line.startsWith('LocalGitStorageDir=')) {
|
|
1405
|
+
info.localGitStorageDir = line.replace('LocalGitStorageDir=', '').trim();
|
|
1406
|
+
}
|
|
1407
|
+
else if (line.startsWith('LocalMediaDir=')) {
|
|
1408
|
+
info.localMediaDir = line.replace('LocalMediaDir=', '').trim();
|
|
1409
|
+
}
|
|
1410
|
+
else if (line.startsWith('LocalReferenceDirs=')) {
|
|
1411
|
+
info.localReferenceDirs = line.replace('LocalReferenceDirs=', '').trim();
|
|
1412
|
+
}
|
|
1413
|
+
else if (line.startsWith('TempDir=')) {
|
|
1414
|
+
info.tempDir = line.replace('TempDir=', '').trim();
|
|
1415
|
+
}
|
|
1416
|
+
else if (line.startsWith('ConcurrentTransfers=')) {
|
|
1417
|
+
info.concurrentTransfers = Number.parseInt(line.replace('ConcurrentTransfers=', '').trim(), 10);
|
|
1418
|
+
}
|
|
1419
|
+
else if (line.startsWith('TusTransfers=')) {
|
|
1420
|
+
info.tusTransfers = line.replace('TusTransfers=', '').trim() === 'true';
|
|
1421
|
+
}
|
|
1422
|
+
else if (line.startsWith('BasicTransfersOnly=')) {
|
|
1423
|
+
info.basicTransfersOnly = line.replace('BasicTransfersOnly=', '').trim() === 'true';
|
|
1424
|
+
}
|
|
1425
|
+
else if (line.startsWith('SkipDownloadErrors=')) {
|
|
1426
|
+
info.skipDownloadErrors = line.replace('SkipDownloadErrors=', '').trim() === 'true';
|
|
1427
|
+
}
|
|
1428
|
+
else if (line.startsWith('FetchRecentAlways=')) {
|
|
1429
|
+
info.fetchRecentAlways = line.replace('FetchRecentAlways=', '').trim() === 'true';
|
|
1430
|
+
}
|
|
1431
|
+
else if (line.startsWith('FetchRecentRefsDays=')) {
|
|
1432
|
+
info.fetchRecentRefsDays = Number.parseInt(line.replace('FetchRecentRefsDays=', '').trim(), 10);
|
|
1433
|
+
}
|
|
1434
|
+
else if (line.startsWith('FetchRecentCommitsDays=')) {
|
|
1435
|
+
info.fetchRecentCommitsDays = Number.parseInt(line.replace('FetchRecentCommitsDays=', '').trim(), 10);
|
|
1436
|
+
}
|
|
1437
|
+
else if (line.startsWith('FetchRecentRefsIncludeRemotes=')) {
|
|
1438
|
+
info.fetchRecentRefsIncludeRemotes =
|
|
1439
|
+
line.replace('FetchRecentRefsIncludeRemotes=', '').trim() === 'true';
|
|
1440
|
+
}
|
|
1441
|
+
else if (line.startsWith('PruneOffsetDays=')) {
|
|
1442
|
+
info.pruneOffsetDays = Number.parseInt(line.replace('PruneOffsetDays=', '').trim(), 10);
|
|
1443
|
+
}
|
|
1444
|
+
else if (line.startsWith('PruneVerifyRemoteAlways=')) {
|
|
1445
|
+
info.pruneVerifyRemoteAlways =
|
|
1446
|
+
line.replace('PruneVerifyRemoteAlways=', '').trim() === 'true';
|
|
1447
|
+
}
|
|
1448
|
+
else if (line.startsWith('PruneRemoteName=')) {
|
|
1449
|
+
info.pruneRemoteName = line.replace('PruneRemoteName=', '').trim();
|
|
1450
|
+
}
|
|
1451
|
+
else if (line.startsWith('AccessDownload=')) {
|
|
1452
|
+
info.accessDownload = line.replace('AccessDownload=', '').trim();
|
|
1453
|
+
}
|
|
1454
|
+
else if (line.startsWith('AccessUpload=')) {
|
|
1455
|
+
info.accessUpload = line.replace('AccessUpload=', '').trim();
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return info;
|
|
1459
|
+
}
|
|
1460
|
+
async lfsVersion(opts) {
|
|
1461
|
+
const result = await this.runner.runOrThrow(this.context, ['lfs', 'version'], {
|
|
620
1462
|
signal: opts?.signal,
|
|
621
|
-
onProgress: opts?.onProgress,
|
|
622
1463
|
});
|
|
1464
|
+
// Format: "git-lfs/3.4.0 (GitHub; linux amd64; go 1.21.1)"
|
|
1465
|
+
const match = result.stdout.match(/git-lfs\/(\S+)/);
|
|
1466
|
+
return match?.[1] ?? result.stdout.trim();
|
|
623
1467
|
}
|
|
624
1468
|
// ==========================================================================
|
|
625
1469
|
// Worktree Operations
|
|
@@ -638,16 +1482,37 @@ export class WorktreeRepoImpl {
|
|
|
638
1482
|
if (opts?.track) {
|
|
639
1483
|
args.push('--track');
|
|
640
1484
|
}
|
|
1485
|
+
// New options
|
|
1486
|
+
if (opts?.force) {
|
|
1487
|
+
args.push('--force');
|
|
1488
|
+
}
|
|
1489
|
+
if (opts?.checkout === true) {
|
|
1490
|
+
args.push('--checkout');
|
|
1491
|
+
}
|
|
1492
|
+
else if (opts?.checkout === false) {
|
|
1493
|
+
args.push('--no-checkout');
|
|
1494
|
+
}
|
|
1495
|
+
if (opts?.lock) {
|
|
1496
|
+
args.push('--lock');
|
|
1497
|
+
}
|
|
1498
|
+
if (opts?.orphan) {
|
|
1499
|
+
args.push('--orphan');
|
|
1500
|
+
}
|
|
1501
|
+
// -b must come before path
|
|
1502
|
+
if (opts?.branch && !(opts.detach || opts.orphan)) {
|
|
1503
|
+
args.push('-b', opts.branch);
|
|
1504
|
+
}
|
|
641
1505
|
args.push(path);
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
1506
|
+
// Add commit-ish after path (e.g., branch name, tag, or commit hash)
|
|
1507
|
+
if (opts?.commitish) {
|
|
1508
|
+
args.push(opts.commitish);
|
|
646
1509
|
}
|
|
647
1510
|
await this.runner.runOrThrow(this.context, args, {
|
|
648
1511
|
signal: opts?.signal,
|
|
649
1512
|
onProgress: opts?.onProgress,
|
|
650
1513
|
});
|
|
1514
|
+
// Return a new WorktreeRepo for the newly created worktree, preserving LFS mode
|
|
1515
|
+
return new WorktreeRepoImpl(this.runner, path, { lfs: this._lfsMode });
|
|
651
1516
|
}
|
|
652
1517
|
async worktreeRemove(path, opts) {
|
|
653
1518
|
const args = ['worktree', 'remove'];
|
|
@@ -667,6 +1532,10 @@ export class WorktreeRepoImpl {
|
|
|
667
1532
|
if (opts?.verbose) {
|
|
668
1533
|
args.push('--verbose');
|
|
669
1534
|
}
|
|
1535
|
+
// New options
|
|
1536
|
+
if (opts?.expire) {
|
|
1537
|
+
args.push(`--expire=${opts.expire}`);
|
|
1538
|
+
}
|
|
670
1539
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
671
1540
|
signal: opts?.signal,
|
|
672
1541
|
});
|
|
@@ -688,11 +1557,37 @@ export class WorktreeRepoImpl {
|
|
|
688
1557
|
signal: opts?.signal,
|
|
689
1558
|
});
|
|
690
1559
|
}
|
|
1560
|
+
async worktreeMove(src, dst, opts) {
|
|
1561
|
+
const args = ['worktree', 'move'];
|
|
1562
|
+
if (opts?.force) {
|
|
1563
|
+
args.push('--force');
|
|
1564
|
+
}
|
|
1565
|
+
args.push(src, dst);
|
|
1566
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1567
|
+
signal: opts?.signal,
|
|
1568
|
+
});
|
|
1569
|
+
// Return a new WorktreeRepo for the worktree at the new location, preserving LFS mode
|
|
1570
|
+
return new WorktreeRepoImpl(this.runner, dst, { lfs: this._lfsMode });
|
|
1571
|
+
}
|
|
1572
|
+
async worktreeRepair(paths, opts) {
|
|
1573
|
+
const args = ['worktree', 'repair'];
|
|
1574
|
+
if (paths && paths.length > 0) {
|
|
1575
|
+
args.push(...paths);
|
|
1576
|
+
}
|
|
1577
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1578
|
+
signal: opts?.signal,
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
691
1581
|
// ==========================================================================
|
|
692
1582
|
// High-level API - add
|
|
693
1583
|
// ==========================================================================
|
|
694
1584
|
async add(paths, opts) {
|
|
695
1585
|
const args = ['add'];
|
|
1586
|
+
// Verbosity
|
|
1587
|
+
if (opts?.verbose) {
|
|
1588
|
+
args.push('--verbose');
|
|
1589
|
+
}
|
|
1590
|
+
// Main options
|
|
696
1591
|
if (opts?.all) {
|
|
697
1592
|
args.push('--all');
|
|
698
1593
|
}
|
|
@@ -705,6 +1600,34 @@ export class WorktreeRepoImpl {
|
|
|
705
1600
|
if (opts?.force) {
|
|
706
1601
|
args.push('--force');
|
|
707
1602
|
}
|
|
1603
|
+
// New options
|
|
1604
|
+
if (opts?.intentToAdd) {
|
|
1605
|
+
args.push('--intent-to-add');
|
|
1606
|
+
}
|
|
1607
|
+
if (opts?.renormalize) {
|
|
1608
|
+
args.push('--renormalize');
|
|
1609
|
+
}
|
|
1610
|
+
if (opts?.ignoreRemoval) {
|
|
1611
|
+
args.push('--ignore-removal');
|
|
1612
|
+
}
|
|
1613
|
+
if (opts?.refresh) {
|
|
1614
|
+
args.push('--refresh');
|
|
1615
|
+
}
|
|
1616
|
+
if (opts?.ignoreErrors) {
|
|
1617
|
+
args.push('--ignore-errors');
|
|
1618
|
+
}
|
|
1619
|
+
if (opts?.ignoreMissing) {
|
|
1620
|
+
args.push('--ignore-missing');
|
|
1621
|
+
}
|
|
1622
|
+
if (opts?.sparse) {
|
|
1623
|
+
args.push('--sparse');
|
|
1624
|
+
}
|
|
1625
|
+
if (opts?.chmod) {
|
|
1626
|
+
args.push(`--chmod=${opts.chmod}`);
|
|
1627
|
+
}
|
|
1628
|
+
if (opts?.pathspecFromFile) {
|
|
1629
|
+
args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
|
|
1630
|
+
}
|
|
708
1631
|
const pathList = Array.isArray(paths) ? paths : [paths];
|
|
709
1632
|
args.push('--', ...pathList);
|
|
710
1633
|
await this.runner.runOrThrow(this.context, args, {
|
|
@@ -720,12 +1643,41 @@ export class WorktreeRepoImpl {
|
|
|
720
1643
|
'--list',
|
|
721
1644
|
'--format=%(refname:short)%00%(objectname:short)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(HEAD)',
|
|
722
1645
|
];
|
|
1646
|
+
// Existing options
|
|
723
1647
|
if (opts?.all) {
|
|
724
1648
|
args.push('--all');
|
|
725
1649
|
}
|
|
726
1650
|
if (opts?.remotes) {
|
|
727
1651
|
args.push('--remotes');
|
|
728
1652
|
}
|
|
1653
|
+
// New options
|
|
1654
|
+
if (opts?.quiet) {
|
|
1655
|
+
args.push('--quiet');
|
|
1656
|
+
}
|
|
1657
|
+
if (opts?.contains) {
|
|
1658
|
+
args.push(`--contains=${opts.contains}`);
|
|
1659
|
+
}
|
|
1660
|
+
if (opts?.noContains) {
|
|
1661
|
+
args.push(`--no-contains=${opts.noContains}`);
|
|
1662
|
+
}
|
|
1663
|
+
if (opts?.abbrev !== undefined) {
|
|
1664
|
+
args.push(`--abbrev=${opts.abbrev}`);
|
|
1665
|
+
}
|
|
1666
|
+
if (opts?.merged) {
|
|
1667
|
+
args.push(`--merged=${opts.merged}`);
|
|
1668
|
+
}
|
|
1669
|
+
if (opts?.noMerged) {
|
|
1670
|
+
args.push(`--no-merged=${opts.noMerged}`);
|
|
1671
|
+
}
|
|
1672
|
+
if (opts?.sort) {
|
|
1673
|
+
args.push(`--sort=${opts.sort}`);
|
|
1674
|
+
}
|
|
1675
|
+
if (opts?.pointsAt) {
|
|
1676
|
+
args.push(`--points-at=${opts.pointsAt}`);
|
|
1677
|
+
}
|
|
1678
|
+
if (opts?.ignoreCase) {
|
|
1679
|
+
args.push('--ignore-case');
|
|
1680
|
+
}
|
|
729
1681
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
730
1682
|
signal: opts?.signal,
|
|
731
1683
|
});
|
|
@@ -761,12 +1713,23 @@ export class WorktreeRepoImpl {
|
|
|
761
1713
|
}
|
|
762
1714
|
async branchCreate(name, opts) {
|
|
763
1715
|
const args = ['branch'];
|
|
1716
|
+
// Existing options
|
|
764
1717
|
if (opts?.force) {
|
|
765
1718
|
args.push('--force');
|
|
766
1719
|
}
|
|
767
1720
|
if (opts?.track) {
|
|
768
1721
|
args.push('--track');
|
|
769
1722
|
}
|
|
1723
|
+
// New options
|
|
1724
|
+
if (opts?.setUpstreamTo) {
|
|
1725
|
+
args.push(`--set-upstream-to=${opts.setUpstreamTo}`);
|
|
1726
|
+
}
|
|
1727
|
+
if (opts?.createReflog) {
|
|
1728
|
+
args.push('--create-reflog');
|
|
1729
|
+
}
|
|
1730
|
+
if (opts?.recurseSubmodules) {
|
|
1731
|
+
args.push('--recurse-submodules');
|
|
1732
|
+
}
|
|
770
1733
|
args.push(name);
|
|
771
1734
|
if (opts?.startPoint) {
|
|
772
1735
|
args.push(opts.startPoint);
|
|
@@ -796,23 +1759,89 @@ export class WorktreeRepoImpl {
|
|
|
796
1759
|
signal: opts?.signal,
|
|
797
1760
|
});
|
|
798
1761
|
}
|
|
799
|
-
//
|
|
800
|
-
|
|
801
|
-
// ==========================================================================
|
|
802
|
-
async checkout(target, opts) {
|
|
1762
|
+
// Implementation
|
|
1763
|
+
async checkout(targetOrPaths, opts) {
|
|
803
1764
|
const args = ['checkout'];
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
1765
|
+
// Determine mode based on first argument type
|
|
1766
|
+
const isPathMode = Array.isArray(targetOrPaths);
|
|
1767
|
+
if (isPathMode) {
|
|
1768
|
+
// Pathspec mode: git checkout [<tree-ish>] -- <pathspec>...
|
|
1769
|
+
const pathOpts = opts;
|
|
1770
|
+
if (pathOpts?.force) {
|
|
1771
|
+
args.push('--force');
|
|
1772
|
+
}
|
|
1773
|
+
if (pathOpts?.quiet) {
|
|
1774
|
+
args.push('--quiet');
|
|
1775
|
+
}
|
|
1776
|
+
if (pathOpts?.overlay !== undefined) {
|
|
1777
|
+
args.push(pathOpts.overlay ? '--overlay' : '--no-overlay');
|
|
1778
|
+
}
|
|
1779
|
+
if (pathOpts?.ours) {
|
|
1780
|
+
args.push('--ours');
|
|
1781
|
+
}
|
|
1782
|
+
if (pathOpts?.theirs) {
|
|
1783
|
+
args.push('--theirs');
|
|
1784
|
+
}
|
|
1785
|
+
if (pathOpts?.pathspecFromFile) {
|
|
1786
|
+
args.push(`--pathspec-from-file=${pathOpts.pathspecFromFile}`);
|
|
1787
|
+
}
|
|
1788
|
+
// Add source tree-ish if specified
|
|
1789
|
+
if (pathOpts?.source) {
|
|
1790
|
+
args.push(pathOpts.source);
|
|
1791
|
+
}
|
|
1792
|
+
// Add -- separator and pathspecs
|
|
1793
|
+
args.push('--');
|
|
1794
|
+
args.push(...targetOrPaths);
|
|
812
1795
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
1796
|
+
else {
|
|
1797
|
+
// Branch switching mode: git checkout <branch>
|
|
1798
|
+
const branchOpts = opts;
|
|
1799
|
+
if (branchOpts?.force) {
|
|
1800
|
+
args.push('--force');
|
|
1801
|
+
}
|
|
1802
|
+
if (branchOpts?.forceCreateBranch) {
|
|
1803
|
+
args.push('-B');
|
|
1804
|
+
}
|
|
1805
|
+
else if (branchOpts?.createBranch) {
|
|
1806
|
+
args.push('-b');
|
|
1807
|
+
}
|
|
1808
|
+
if (branchOpts?.track) {
|
|
1809
|
+
args.push('--track');
|
|
1810
|
+
}
|
|
1811
|
+
if (branchOpts?.createReflog) {
|
|
1812
|
+
args.push('-l');
|
|
1813
|
+
}
|
|
1814
|
+
if (branchOpts?.guess !== undefined) {
|
|
1815
|
+
args.push(branchOpts.guess ? '--guess' : '--no-guess');
|
|
1816
|
+
}
|
|
1817
|
+
if (branchOpts?.quiet) {
|
|
1818
|
+
args.push('--quiet');
|
|
1819
|
+
}
|
|
1820
|
+
if (branchOpts?.recurseSubmodules) {
|
|
1821
|
+
args.push('--recurse-submodules');
|
|
1822
|
+
}
|
|
1823
|
+
if (branchOpts?.merge) {
|
|
1824
|
+
args.push('--merge');
|
|
1825
|
+
}
|
|
1826
|
+
if (branchOpts?.conflict) {
|
|
1827
|
+
args.push(`--conflict=${branchOpts.conflict}`);
|
|
1828
|
+
}
|
|
1829
|
+
if (branchOpts?.detach) {
|
|
1830
|
+
args.push('--detach');
|
|
1831
|
+
}
|
|
1832
|
+
if (branchOpts?.orphan) {
|
|
1833
|
+
args.push('--orphan');
|
|
1834
|
+
}
|
|
1835
|
+
if (branchOpts?.overwriteIgnore === false) {
|
|
1836
|
+
args.push('--no-overwrite-ignore');
|
|
1837
|
+
}
|
|
1838
|
+
if (branchOpts?.ignoreOtherWorktrees) {
|
|
1839
|
+
args.push('--ignore-other-worktrees');
|
|
1840
|
+
}
|
|
1841
|
+
args.push(targetOrPaths);
|
|
1842
|
+
if (branchOpts?.startPoint) {
|
|
1843
|
+
args.push(branchOpts.startPoint);
|
|
1844
|
+
}
|
|
816
1845
|
}
|
|
817
1846
|
await this.runner.runOrThrow(this.context, args, {
|
|
818
1847
|
signal: opts?.signal,
|
|
@@ -823,6 +1852,7 @@ export class WorktreeRepoImpl {
|
|
|
823
1852
|
// ==========================================================================
|
|
824
1853
|
async commit(opts) {
|
|
825
1854
|
const args = ['commit'];
|
|
1855
|
+
// Existing options
|
|
826
1856
|
if (opts?.message) {
|
|
827
1857
|
args.push('-m', opts.message);
|
|
828
1858
|
}
|
|
@@ -854,6 +1884,61 @@ export class WorktreeRepoImpl {
|
|
|
854
1884
|
else if (opts?.noGpgSign) {
|
|
855
1885
|
args.push('--no-gpg-sign');
|
|
856
1886
|
}
|
|
1887
|
+
// New options
|
|
1888
|
+
if (opts?.quiet) {
|
|
1889
|
+
args.push('--quiet');
|
|
1890
|
+
}
|
|
1891
|
+
if (opts?.verbose) {
|
|
1892
|
+
args.push('--verbose');
|
|
1893
|
+
}
|
|
1894
|
+
if (opts?.file) {
|
|
1895
|
+
args.push('--file', opts.file);
|
|
1896
|
+
}
|
|
1897
|
+
if (opts?.reeditMessage) {
|
|
1898
|
+
args.push('--reedit-message', opts.reeditMessage);
|
|
1899
|
+
}
|
|
1900
|
+
if (opts?.reuseMessage) {
|
|
1901
|
+
args.push('--reuse-message', opts.reuseMessage);
|
|
1902
|
+
}
|
|
1903
|
+
if (opts?.fixup) {
|
|
1904
|
+
args.push('--fixup', opts.fixup);
|
|
1905
|
+
}
|
|
1906
|
+
if (opts?.squash) {
|
|
1907
|
+
args.push('--squash', opts.squash);
|
|
1908
|
+
}
|
|
1909
|
+
if (opts?.resetAuthor) {
|
|
1910
|
+
args.push('--reset-author');
|
|
1911
|
+
}
|
|
1912
|
+
if (opts?.trailer) {
|
|
1913
|
+
const trailers = Array.isArray(opts.trailer) ? opts.trailer : [opts.trailer];
|
|
1914
|
+
for (const trailer of trailers) {
|
|
1915
|
+
args.push('--trailer', trailer);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
if (opts?.signoff) {
|
|
1919
|
+
args.push('--signoff');
|
|
1920
|
+
}
|
|
1921
|
+
if (opts?.cleanup) {
|
|
1922
|
+
args.push(`--cleanup=${opts.cleanup}`);
|
|
1923
|
+
}
|
|
1924
|
+
if (opts?.include) {
|
|
1925
|
+
args.push('--include');
|
|
1926
|
+
}
|
|
1927
|
+
if (opts?.only) {
|
|
1928
|
+
args.push('--only');
|
|
1929
|
+
}
|
|
1930
|
+
if (opts?.noPostRewrite) {
|
|
1931
|
+
args.push('--no-post-rewrite');
|
|
1932
|
+
}
|
|
1933
|
+
if (opts?.untrackedFiles) {
|
|
1934
|
+
args.push(`--untracked-files=${opts.untrackedFiles}`);
|
|
1935
|
+
}
|
|
1936
|
+
if (opts?.pathspecFromFile) {
|
|
1937
|
+
args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
|
|
1938
|
+
}
|
|
1939
|
+
if (opts?.allowEmptyMessage) {
|
|
1940
|
+
args.push('--allow-empty-message');
|
|
1941
|
+
}
|
|
857
1942
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
858
1943
|
signal: opts?.signal,
|
|
859
1944
|
});
|
|
@@ -901,6 +1986,7 @@ export class WorktreeRepoImpl {
|
|
|
901
1986
|
// ==========================================================================
|
|
902
1987
|
async diff(target, opts) {
|
|
903
1988
|
const args = ['diff'];
|
|
1989
|
+
// Existing options
|
|
904
1990
|
if (opts?.staged) {
|
|
905
1991
|
args.push('--staged');
|
|
906
1992
|
}
|
|
@@ -919,6 +2005,79 @@ export class WorktreeRepoImpl {
|
|
|
919
2005
|
if (opts?.ignoreWhitespace) {
|
|
920
2006
|
args.push('-w');
|
|
921
2007
|
}
|
|
2008
|
+
// New options
|
|
2009
|
+
if (opts?.nullTerminated) {
|
|
2010
|
+
args.push('-z');
|
|
2011
|
+
}
|
|
2012
|
+
if (opts?.patch) {
|
|
2013
|
+
args.push('-p');
|
|
2014
|
+
}
|
|
2015
|
+
if (opts?.patchWithRaw) {
|
|
2016
|
+
args.push('--patch-with-raw');
|
|
2017
|
+
}
|
|
2018
|
+
if (opts?.numstat) {
|
|
2019
|
+
args.push('--numstat');
|
|
2020
|
+
}
|
|
2021
|
+
if (opts?.patchWithStat) {
|
|
2022
|
+
args.push('--patch-with-stat');
|
|
2023
|
+
}
|
|
2024
|
+
if (opts?.fullIndex) {
|
|
2025
|
+
args.push('--full-index');
|
|
2026
|
+
}
|
|
2027
|
+
if (opts?.abbrev !== undefined) {
|
|
2028
|
+
args.push(`--abbrev=${opts.abbrev}`);
|
|
2029
|
+
}
|
|
2030
|
+
if (opts?.reverse) {
|
|
2031
|
+
args.push('-R');
|
|
2032
|
+
}
|
|
2033
|
+
if (opts?.detectRewrites !== undefined) {
|
|
2034
|
+
if (opts.detectRewrites === true) {
|
|
2035
|
+
args.push('-B');
|
|
2036
|
+
}
|
|
2037
|
+
else if (typeof opts.detectRewrites === 'string') {
|
|
2038
|
+
args.push(`-B${opts.detectRewrites}`);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
if (opts?.detectRenames !== undefined) {
|
|
2042
|
+
if (opts.detectRenames === true) {
|
|
2043
|
+
args.push('-M');
|
|
2044
|
+
}
|
|
2045
|
+
else if (typeof opts.detectRenames === 'string') {
|
|
2046
|
+
args.push(`-M${opts.detectRenames}`);
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
if (opts?.detectCopies !== undefined) {
|
|
2050
|
+
if (opts.detectCopies === true) {
|
|
2051
|
+
args.push('-C');
|
|
2052
|
+
}
|
|
2053
|
+
else if (typeof opts.detectCopies === 'string') {
|
|
2054
|
+
args.push(`-C${opts.detectCopies}`);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
if (opts?.findCopiesHarder) {
|
|
2058
|
+
args.push('--find-copies-harder');
|
|
2059
|
+
}
|
|
2060
|
+
if (opts?.renameLimit !== undefined) {
|
|
2061
|
+
args.push(`-l${opts.renameLimit}`);
|
|
2062
|
+
}
|
|
2063
|
+
if (opts?.pickaxe) {
|
|
2064
|
+
args.push(`-S${opts.pickaxe}`);
|
|
2065
|
+
}
|
|
2066
|
+
if (opts?.pickaxeAll) {
|
|
2067
|
+
args.push('--pickaxe-all');
|
|
2068
|
+
}
|
|
2069
|
+
if (opts?.text) {
|
|
2070
|
+
args.push('--text');
|
|
2071
|
+
}
|
|
2072
|
+
if (opts?.mergeBase) {
|
|
2073
|
+
args.push(`--merge-base=${opts.mergeBase}`);
|
|
2074
|
+
}
|
|
2075
|
+
if (opts?.noIndex) {
|
|
2076
|
+
args.push('--no-index');
|
|
2077
|
+
}
|
|
2078
|
+
if (opts?.wordDiff) {
|
|
2079
|
+
args.push(`--word-diff=${opts.wordDiff}`);
|
|
2080
|
+
}
|
|
922
2081
|
if (target) {
|
|
923
2082
|
args.push(target);
|
|
924
2083
|
}
|
|
@@ -978,6 +2137,7 @@ export class WorktreeRepoImpl {
|
|
|
978
2137
|
return { success: true, hash };
|
|
979
2138
|
}
|
|
980
2139
|
const args = ['merge'];
|
|
2140
|
+
// Existing options
|
|
981
2141
|
if (opts?.message) {
|
|
982
2142
|
args.push('-m', opts.message);
|
|
983
2143
|
}
|
|
@@ -1007,6 +2167,62 @@ export class WorktreeRepoImpl {
|
|
|
1007
2167
|
if (opts?.noVerify) {
|
|
1008
2168
|
args.push('--no-verify');
|
|
1009
2169
|
}
|
|
2170
|
+
// New options
|
|
2171
|
+
if (opts?.noDiffstat) {
|
|
2172
|
+
args.push('-n');
|
|
2173
|
+
}
|
|
2174
|
+
else if (opts?.stat) {
|
|
2175
|
+
args.push('--stat');
|
|
2176
|
+
}
|
|
2177
|
+
if (opts?.compactSummary) {
|
|
2178
|
+
args.push('--compact-summary');
|
|
2179
|
+
}
|
|
2180
|
+
if (opts?.log !== undefined) {
|
|
2181
|
+
if (opts.log === true) {
|
|
2182
|
+
args.push('--log');
|
|
2183
|
+
}
|
|
2184
|
+
else if (typeof opts.log === 'number') {
|
|
2185
|
+
args.push(`--log=${opts.log}`);
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
if (opts?.cleanup) {
|
|
2189
|
+
args.push(`--cleanup=${opts.cleanup}`);
|
|
2190
|
+
}
|
|
2191
|
+
if (opts?.rerereAutoupdate !== undefined) {
|
|
2192
|
+
args.push(opts.rerereAutoupdate ? '--rerere-autoupdate' : '--no-rerere-autoupdate');
|
|
2193
|
+
}
|
|
2194
|
+
if (opts?.verifySignatures) {
|
|
2195
|
+
args.push('--verify-signatures');
|
|
2196
|
+
}
|
|
2197
|
+
if (opts?.verbose) {
|
|
2198
|
+
args.push('--verbose');
|
|
2199
|
+
}
|
|
2200
|
+
if (opts?.quiet) {
|
|
2201
|
+
args.push('--quiet');
|
|
2202
|
+
}
|
|
2203
|
+
if (opts?.allowUnrelatedHistories) {
|
|
2204
|
+
args.push('--allow-unrelated-histories');
|
|
2205
|
+
}
|
|
2206
|
+
if (opts?.gpgSign !== undefined) {
|
|
2207
|
+
if (opts.gpgSign === true) {
|
|
2208
|
+
args.push('-S');
|
|
2209
|
+
}
|
|
2210
|
+
else if (typeof opts.gpgSign === 'string') {
|
|
2211
|
+
args.push(`-S${opts.gpgSign}`);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
if (opts?.autostash) {
|
|
2215
|
+
args.push('--autostash');
|
|
2216
|
+
}
|
|
2217
|
+
if (opts?.overwriteIgnore === false) {
|
|
2218
|
+
args.push('--no-overwrite-ignore');
|
|
2219
|
+
}
|
|
2220
|
+
if (opts?.signoff) {
|
|
2221
|
+
args.push('--signoff');
|
|
2222
|
+
}
|
|
2223
|
+
if (opts?.intoName) {
|
|
2224
|
+
args.push(`--into-name=${opts.intoName}`);
|
|
2225
|
+
}
|
|
1010
2226
|
args.push(branch);
|
|
1011
2227
|
const result = await this.runner.run(this.context, args, {
|
|
1012
2228
|
signal: opts?.signal,
|
|
@@ -1041,9 +2257,11 @@ export class WorktreeRepoImpl {
|
|
|
1041
2257
|
// ==========================================================================
|
|
1042
2258
|
async pull(opts) {
|
|
1043
2259
|
const args = ['pull'];
|
|
2260
|
+
// Progress tracking
|
|
1044
2261
|
if (opts?.onProgress) {
|
|
1045
2262
|
args.push('--progress');
|
|
1046
2263
|
}
|
|
2264
|
+
// Existing options
|
|
1047
2265
|
if (opts?.rebase === true) {
|
|
1048
2266
|
args.push('--rebase');
|
|
1049
2267
|
}
|
|
@@ -1065,6 +2283,136 @@ export class WorktreeRepoImpl {
|
|
|
1065
2283
|
if (opts?.prune) {
|
|
1066
2284
|
args.push('--prune');
|
|
1067
2285
|
}
|
|
2286
|
+
// New options
|
|
2287
|
+
if (opts?.verbose) {
|
|
2288
|
+
args.push('--verbose');
|
|
2289
|
+
}
|
|
2290
|
+
if (opts?.quiet) {
|
|
2291
|
+
args.push('--quiet');
|
|
2292
|
+
}
|
|
2293
|
+
if (opts?.recurseSubmodules !== undefined) {
|
|
2294
|
+
if (opts.recurseSubmodules === true || opts.recurseSubmodules === 'yes') {
|
|
2295
|
+
args.push('--recurse-submodules=yes');
|
|
2296
|
+
}
|
|
2297
|
+
else if (opts.recurseSubmodules === 'on-demand') {
|
|
2298
|
+
args.push('--recurse-submodules=on-demand');
|
|
2299
|
+
}
|
|
2300
|
+
else if (opts.recurseSubmodules === 'no' || opts.recurseSubmodules === false) {
|
|
2301
|
+
args.push('--recurse-submodules=no');
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
if (opts?.noStat) {
|
|
2305
|
+
args.push('-n');
|
|
2306
|
+
}
|
|
2307
|
+
else if (opts?.stat) {
|
|
2308
|
+
args.push('--stat');
|
|
2309
|
+
}
|
|
2310
|
+
if (opts?.compactSummary) {
|
|
2311
|
+
args.push('--compact-summary');
|
|
2312
|
+
}
|
|
2313
|
+
if (opts?.log !== undefined) {
|
|
2314
|
+
if (opts.log === true) {
|
|
2315
|
+
args.push('--log');
|
|
2316
|
+
}
|
|
2317
|
+
else if (typeof opts.log === 'number') {
|
|
2318
|
+
args.push(`--log=${opts.log}`);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
if (opts?.signoff) {
|
|
2322
|
+
args.push('--signoff');
|
|
2323
|
+
}
|
|
2324
|
+
if (opts?.squash) {
|
|
2325
|
+
args.push('--squash');
|
|
2326
|
+
}
|
|
2327
|
+
if (opts?.commit !== undefined) {
|
|
2328
|
+
args.push(opts.commit ? '--commit' : '--no-commit');
|
|
2329
|
+
}
|
|
2330
|
+
if (opts?.cleanup) {
|
|
2331
|
+
args.push(`--cleanup=${opts.cleanup}`);
|
|
2332
|
+
}
|
|
2333
|
+
if (opts?.verify !== undefined) {
|
|
2334
|
+
args.push(opts.verify ? '--verify' : '--no-verify');
|
|
2335
|
+
}
|
|
2336
|
+
if (opts?.verifySignatures) {
|
|
2337
|
+
args.push('--verify-signatures');
|
|
2338
|
+
}
|
|
2339
|
+
if (opts?.autostash) {
|
|
2340
|
+
args.push('--autostash');
|
|
2341
|
+
}
|
|
2342
|
+
if (opts?.strategy) {
|
|
2343
|
+
args.push(`--strategy=${opts.strategy}`);
|
|
2344
|
+
}
|
|
2345
|
+
if (opts?.strategyOption) {
|
|
2346
|
+
const strategyOpts = Array.isArray(opts.strategyOption)
|
|
2347
|
+
? opts.strategyOption
|
|
2348
|
+
: [opts.strategyOption];
|
|
2349
|
+
for (const opt of strategyOpts) {
|
|
2350
|
+
args.push('-X', opt);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
if (opts?.gpgSign !== undefined) {
|
|
2354
|
+
if (opts.gpgSign === true) {
|
|
2355
|
+
args.push('-S');
|
|
2356
|
+
}
|
|
2357
|
+
else if (typeof opts.gpgSign === 'string') {
|
|
2358
|
+
args.push(`-S${opts.gpgSign}`);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
if (opts?.allowUnrelatedHistories) {
|
|
2362
|
+
args.push('--allow-unrelated-histories');
|
|
2363
|
+
}
|
|
2364
|
+
if (opts?.all) {
|
|
2365
|
+
args.push('--all');
|
|
2366
|
+
}
|
|
2367
|
+
if (opts?.append) {
|
|
2368
|
+
args.push('--append');
|
|
2369
|
+
}
|
|
2370
|
+
if (opts?.force) {
|
|
2371
|
+
args.push('--force');
|
|
2372
|
+
}
|
|
2373
|
+
if (opts?.jobs !== undefined) {
|
|
2374
|
+
args.push(`--jobs=${opts.jobs}`);
|
|
2375
|
+
}
|
|
2376
|
+
if (opts?.dryRun) {
|
|
2377
|
+
args.push('--dry-run');
|
|
2378
|
+
}
|
|
2379
|
+
if (opts?.keep) {
|
|
2380
|
+
args.push('--keep');
|
|
2381
|
+
}
|
|
2382
|
+
if (opts?.depth !== undefined) {
|
|
2383
|
+
args.push(`--depth=${opts.depth}`);
|
|
2384
|
+
}
|
|
2385
|
+
if (opts?.shallowSince) {
|
|
2386
|
+
const since = opts.shallowSince instanceof Date ? opts.shallowSince.toISOString() : opts.shallowSince;
|
|
2387
|
+
args.push(`--shallow-since=${since}`);
|
|
2388
|
+
}
|
|
2389
|
+
if (opts?.shallowExclude) {
|
|
2390
|
+
const excludes = Array.isArray(opts.shallowExclude)
|
|
2391
|
+
? opts.shallowExclude
|
|
2392
|
+
: [opts.shallowExclude];
|
|
2393
|
+
for (const exclude of excludes) {
|
|
2394
|
+
args.push(`--shallow-exclude=${exclude}`);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (opts?.deepen !== undefined) {
|
|
2398
|
+
args.push(`--deepen=${opts.deepen}`);
|
|
2399
|
+
}
|
|
2400
|
+
if (opts?.unshallow) {
|
|
2401
|
+
args.push('--unshallow');
|
|
2402
|
+
}
|
|
2403
|
+
if (opts?.updateShallow) {
|
|
2404
|
+
args.push('--update-shallow');
|
|
2405
|
+
}
|
|
2406
|
+
if (opts?.ipv4) {
|
|
2407
|
+
args.push('--ipv4');
|
|
2408
|
+
}
|
|
2409
|
+
if (opts?.ipv6) {
|
|
2410
|
+
args.push('--ipv6');
|
|
2411
|
+
}
|
|
2412
|
+
if (opts?.setUpstream) {
|
|
2413
|
+
args.push('--set-upstream');
|
|
2414
|
+
}
|
|
2415
|
+
// Remote and branch (must be last)
|
|
1068
2416
|
if (opts?.remote) {
|
|
1069
2417
|
args.push(opts.remote);
|
|
1070
2418
|
}
|
|
@@ -1081,9 +2429,26 @@ export class WorktreeRepoImpl {
|
|
|
1081
2429
|
// ==========================================================================
|
|
1082
2430
|
async reset(target, opts) {
|
|
1083
2431
|
const args = ['reset'];
|
|
2432
|
+
// Existing options
|
|
1084
2433
|
if (opts?.mode) {
|
|
1085
2434
|
args.push(`--${opts.mode}`);
|
|
1086
2435
|
}
|
|
2436
|
+
// New options
|
|
2437
|
+
if (opts?.quiet) {
|
|
2438
|
+
args.push('--quiet');
|
|
2439
|
+
}
|
|
2440
|
+
if (opts?.noRefresh) {
|
|
2441
|
+
args.push('--no-refresh');
|
|
2442
|
+
}
|
|
2443
|
+
if (opts?.recurseSubmodules) {
|
|
2444
|
+
args.push('--recurse-submodules');
|
|
2445
|
+
}
|
|
2446
|
+
if (opts?.intentToAdd) {
|
|
2447
|
+
args.push('--intent-to-add');
|
|
2448
|
+
}
|
|
2449
|
+
if (opts?.pathspecFromFile) {
|
|
2450
|
+
args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
|
|
2451
|
+
}
|
|
1087
2452
|
if (target) {
|
|
1088
2453
|
args.push(target);
|
|
1089
2454
|
}
|
|
@@ -1096,6 +2461,7 @@ export class WorktreeRepoImpl {
|
|
|
1096
2461
|
// ==========================================================================
|
|
1097
2462
|
async rm(paths, opts) {
|
|
1098
2463
|
const args = ['rm'];
|
|
2464
|
+
// Existing options
|
|
1099
2465
|
if (opts?.force) {
|
|
1100
2466
|
args.push('--force');
|
|
1101
2467
|
}
|
|
@@ -1108,6 +2474,19 @@ export class WorktreeRepoImpl {
|
|
|
1108
2474
|
if (opts?.dryRun) {
|
|
1109
2475
|
args.push('--dry-run');
|
|
1110
2476
|
}
|
|
2477
|
+
// New options
|
|
2478
|
+
if (opts?.quiet) {
|
|
2479
|
+
args.push('--quiet');
|
|
2480
|
+
}
|
|
2481
|
+
if (opts?.ignoreUnmatch) {
|
|
2482
|
+
args.push('--ignore-unmatch');
|
|
2483
|
+
}
|
|
2484
|
+
if (opts?.sparse) {
|
|
2485
|
+
args.push('--sparse');
|
|
2486
|
+
}
|
|
2487
|
+
if (opts?.pathspecFromFile) {
|
|
2488
|
+
args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
|
|
2489
|
+
}
|
|
1111
2490
|
const pathList = Array.isArray(paths) ? paths : [paths];
|
|
1112
2491
|
args.push('--', ...pathList);
|
|
1113
2492
|
await this.runner.runOrThrow(this.context, args, {
|
|
@@ -1156,6 +2535,7 @@ export class WorktreeRepoImpl {
|
|
|
1156
2535
|
}
|
|
1157
2536
|
async stashPush(opts) {
|
|
1158
2537
|
const args = ['stash', 'push'];
|
|
2538
|
+
// Existing options
|
|
1159
2539
|
if (opts?.message) {
|
|
1160
2540
|
args.push('-m', opts.message);
|
|
1161
2541
|
}
|
|
@@ -1165,6 +2545,19 @@ export class WorktreeRepoImpl {
|
|
|
1165
2545
|
if (opts?.keepIndex) {
|
|
1166
2546
|
args.push('--keep-index');
|
|
1167
2547
|
}
|
|
2548
|
+
// New options
|
|
2549
|
+
if (opts?.staged) {
|
|
2550
|
+
args.push('--staged');
|
|
2551
|
+
}
|
|
2552
|
+
if (opts?.quiet) {
|
|
2553
|
+
args.push('--quiet');
|
|
2554
|
+
}
|
|
2555
|
+
if (opts?.all) {
|
|
2556
|
+
args.push('--all');
|
|
2557
|
+
}
|
|
2558
|
+
if (opts?.pathspecFromFile) {
|
|
2559
|
+
args.push(`--pathspec-from-file=${opts.pathspecFromFile}`);
|
|
2560
|
+
}
|
|
1168
2561
|
if (opts?.paths && opts.paths.length > 0) {
|
|
1169
2562
|
args.push('--', ...opts.paths);
|
|
1170
2563
|
}
|
|
@@ -1215,6 +2608,7 @@ export class WorktreeRepoImpl {
|
|
|
1215
2608
|
// ==========================================================================
|
|
1216
2609
|
async switch(branch, opts) {
|
|
1217
2610
|
const args = ['switch'];
|
|
2611
|
+
// Existing options
|
|
1218
2612
|
if (opts?.create) {
|
|
1219
2613
|
args.push('-c');
|
|
1220
2614
|
}
|
|
@@ -1230,6 +2624,34 @@ export class WorktreeRepoImpl {
|
|
|
1230
2624
|
if (opts?.detach) {
|
|
1231
2625
|
args.push('--detach');
|
|
1232
2626
|
}
|
|
2627
|
+
// New options
|
|
2628
|
+
if (opts?.guess !== undefined) {
|
|
2629
|
+
args.push(opts.guess ? '--guess' : '--no-guess');
|
|
2630
|
+
}
|
|
2631
|
+
if (opts?.quiet) {
|
|
2632
|
+
args.push('--quiet');
|
|
2633
|
+
}
|
|
2634
|
+
if (opts?.recurseSubmodules) {
|
|
2635
|
+
args.push('--recurse-submodules');
|
|
2636
|
+
}
|
|
2637
|
+
if (opts?.merge) {
|
|
2638
|
+
args.push('--merge');
|
|
2639
|
+
}
|
|
2640
|
+
if (opts?.conflict) {
|
|
2641
|
+
args.push(`--conflict=${opts.conflict}`);
|
|
2642
|
+
}
|
|
2643
|
+
if (opts?.force) {
|
|
2644
|
+
args.push('--force');
|
|
2645
|
+
}
|
|
2646
|
+
if (opts?.orphan) {
|
|
2647
|
+
args.push('--orphan');
|
|
2648
|
+
}
|
|
2649
|
+
if (opts?.overwriteIgnore === false) {
|
|
2650
|
+
args.push('--no-overwrite-ignore');
|
|
2651
|
+
}
|
|
2652
|
+
if (opts?.ignoreOtherWorktrees) {
|
|
2653
|
+
args.push('--ignore-other-worktrees');
|
|
2654
|
+
}
|
|
1233
2655
|
args.push(branch);
|
|
1234
2656
|
if (opts?.startPoint) {
|
|
1235
2657
|
args.push(opts.startPoint);
|
|
@@ -1243,9 +2665,32 @@ export class WorktreeRepoImpl {
|
|
|
1243
2665
|
// ==========================================================================
|
|
1244
2666
|
async tagList(opts) {
|
|
1245
2667
|
const args = ['tag', '--list'];
|
|
2668
|
+
// Existing options
|
|
1246
2669
|
if (opts?.sort) {
|
|
1247
2670
|
args.push(`--sort=${opts.sort}`);
|
|
1248
2671
|
}
|
|
2672
|
+
// New options
|
|
2673
|
+
if (opts?.lines !== undefined) {
|
|
2674
|
+
args.push(`-n${opts.lines}`);
|
|
2675
|
+
}
|
|
2676
|
+
if (opts?.contains) {
|
|
2677
|
+
args.push(`--contains=${opts.contains}`);
|
|
2678
|
+
}
|
|
2679
|
+
if (opts?.noContains) {
|
|
2680
|
+
args.push(`--no-contains=${opts.noContains}`);
|
|
2681
|
+
}
|
|
2682
|
+
if (opts?.merged) {
|
|
2683
|
+
args.push(`--merged=${opts.merged}`);
|
|
2684
|
+
}
|
|
2685
|
+
if (opts?.noMerged) {
|
|
2686
|
+
args.push(`--no-merged=${opts.noMerged}`);
|
|
2687
|
+
}
|
|
2688
|
+
if (opts?.pointsAt) {
|
|
2689
|
+
args.push(`--points-at=${opts.pointsAt}`);
|
|
2690
|
+
}
|
|
2691
|
+
if (opts?.ignoreCase) {
|
|
2692
|
+
args.push('--ignore-case');
|
|
2693
|
+
}
|
|
1249
2694
|
if (opts?.pattern) {
|
|
1250
2695
|
args.push(opts.pattern);
|
|
1251
2696
|
}
|
|
@@ -1256,6 +2701,7 @@ export class WorktreeRepoImpl {
|
|
|
1256
2701
|
}
|
|
1257
2702
|
async tagCreate(name, opts) {
|
|
1258
2703
|
const args = ['tag'];
|
|
2704
|
+
// Existing options
|
|
1259
2705
|
if (opts?.sign) {
|
|
1260
2706
|
args.push('-s');
|
|
1261
2707
|
}
|
|
@@ -1269,6 +2715,29 @@ export class WorktreeRepoImpl {
|
|
|
1269
2715
|
if (opts?.force) {
|
|
1270
2716
|
args.push('--force');
|
|
1271
2717
|
}
|
|
2718
|
+
// New options
|
|
2719
|
+
if (opts?.file) {
|
|
2720
|
+
// If using file, we need -a for annotated tag (unless signing)
|
|
2721
|
+
if (!(opts.sign || opts.message)) {
|
|
2722
|
+
args.push('-a');
|
|
2723
|
+
}
|
|
2724
|
+
args.push('--file', opts.file);
|
|
2725
|
+
}
|
|
2726
|
+
if (opts?.trailer) {
|
|
2727
|
+
const trailers = Array.isArray(opts.trailer) ? opts.trailer : [opts.trailer];
|
|
2728
|
+
for (const trailer of trailers) {
|
|
2729
|
+
args.push('--trailer', trailer);
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (opts?.cleanup) {
|
|
2733
|
+
args.push(`--cleanup=${opts.cleanup}`);
|
|
2734
|
+
}
|
|
2735
|
+
if (opts?.localUser) {
|
|
2736
|
+
args.push(`--local-user=${opts.localUser}`);
|
|
2737
|
+
}
|
|
2738
|
+
if (opts?.createReflog) {
|
|
2739
|
+
args.push('--create-reflog');
|
|
2740
|
+
}
|
|
1272
2741
|
args.push(name);
|
|
1273
2742
|
if (opts?.commit) {
|
|
1274
2743
|
args.push(opts.commit);
|
|
@@ -1392,6 +2861,45 @@ export class WorktreeRepoImpl {
|
|
|
1392
2861
|
if (opts?.noVerify) {
|
|
1393
2862
|
args.push('--no-verify');
|
|
1394
2863
|
}
|
|
2864
|
+
// New options
|
|
2865
|
+
if (opts?.cleanup) {
|
|
2866
|
+
args.push('--cleanup', opts.cleanup);
|
|
2867
|
+
}
|
|
2868
|
+
if (opts?.rerereAutoupdate === true) {
|
|
2869
|
+
args.push('--rerere-autoupdate');
|
|
2870
|
+
}
|
|
2871
|
+
else if (opts?.rerereAutoupdate === false) {
|
|
2872
|
+
args.push('--no-rerere-autoupdate');
|
|
2873
|
+
}
|
|
2874
|
+
if (opts?.strategyOption) {
|
|
2875
|
+
const strategyOptions = Array.isArray(opts.strategyOption)
|
|
2876
|
+
? opts.strategyOption
|
|
2877
|
+
: [opts.strategyOption];
|
|
2878
|
+
for (const so of strategyOptions) {
|
|
2879
|
+
args.push('-X', so);
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
if (opts?.gpgSign === true) {
|
|
2883
|
+
args.push('-S');
|
|
2884
|
+
}
|
|
2885
|
+
else if (typeof opts?.gpgSign === 'string') {
|
|
2886
|
+
args.push(`-S${opts.gpgSign}`);
|
|
2887
|
+
}
|
|
2888
|
+
if (opts?.appendCommitName) {
|
|
2889
|
+
args.push('-x');
|
|
2890
|
+
}
|
|
2891
|
+
if (opts?.ff) {
|
|
2892
|
+
args.push('--ff');
|
|
2893
|
+
}
|
|
2894
|
+
if (opts?.allowEmpty) {
|
|
2895
|
+
args.push('--allow-empty');
|
|
2896
|
+
}
|
|
2897
|
+
if (opts?.allowEmptyMessage) {
|
|
2898
|
+
args.push('--allow-empty-message');
|
|
2899
|
+
}
|
|
2900
|
+
if (opts?.empty) {
|
|
2901
|
+
args.push('--empty', opts.empty);
|
|
2902
|
+
}
|
|
1395
2903
|
const commitList = Array.isArray(commits) ? commits : [commits];
|
|
1396
2904
|
args.push(...commitList);
|
|
1397
2905
|
await this.runner.runOrThrow(this.context, args, {
|
|
@@ -1418,6 +2926,16 @@ export class WorktreeRepoImpl {
|
|
|
1418
2926
|
if (opts?.dryRun) {
|
|
1419
2927
|
args.push('-n');
|
|
1420
2928
|
}
|
|
2929
|
+
// New options
|
|
2930
|
+
if (opts?.quiet) {
|
|
2931
|
+
args.push('-q');
|
|
2932
|
+
}
|
|
2933
|
+
if (opts?.exclude) {
|
|
2934
|
+
const excludes = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude];
|
|
2935
|
+
for (const pattern of excludes) {
|
|
2936
|
+
args.push('-e', pattern);
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
1421
2939
|
if (opts?.paths && opts.paths.length > 0) {
|
|
1422
2940
|
args.push('--', ...opts.paths);
|
|
1423
2941
|
}
|
|
@@ -1447,6 +2965,16 @@ export class WorktreeRepoImpl {
|
|
|
1447
2965
|
if (opts?.dryRun) {
|
|
1448
2966
|
args.push('-n');
|
|
1449
2967
|
}
|
|
2968
|
+
// New options
|
|
2969
|
+
if (opts?.verbose) {
|
|
2970
|
+
args.push('-v');
|
|
2971
|
+
}
|
|
2972
|
+
if (opts?.skipErrors) {
|
|
2973
|
+
args.push('-k');
|
|
2974
|
+
}
|
|
2975
|
+
if (opts?.sparse) {
|
|
2976
|
+
args.push('--sparse');
|
|
2977
|
+
}
|
|
1450
2978
|
args.push(source, destination);
|
|
1451
2979
|
await this.runner.runOrThrow(this.context, args, {
|
|
1452
2980
|
signal: opts?.signal,
|
|
@@ -1484,6 +3012,111 @@ export class WorktreeRepoImpl {
|
|
|
1484
3012
|
if (opts?.noVerify) {
|
|
1485
3013
|
args.push('--no-verify');
|
|
1486
3014
|
}
|
|
3015
|
+
// New options
|
|
3016
|
+
if (opts?.keepBase) {
|
|
3017
|
+
args.push('--keep-base');
|
|
3018
|
+
}
|
|
3019
|
+
if (opts?.quiet) {
|
|
3020
|
+
args.push('--quiet');
|
|
3021
|
+
}
|
|
3022
|
+
if (opts?.verbose) {
|
|
3023
|
+
args.push('--verbose');
|
|
3024
|
+
}
|
|
3025
|
+
if (opts?.signoff) {
|
|
3026
|
+
args.push('--signoff');
|
|
3027
|
+
}
|
|
3028
|
+
if (opts?.committerDateIsAuthorDate) {
|
|
3029
|
+
args.push('--committer-date-is-author-date');
|
|
3030
|
+
}
|
|
3031
|
+
if (opts?.resetAuthorDate) {
|
|
3032
|
+
args.push('--reset-author-date');
|
|
3033
|
+
}
|
|
3034
|
+
if (opts?.ignoreWhitespace) {
|
|
3035
|
+
args.push('--ignore-whitespace');
|
|
3036
|
+
}
|
|
3037
|
+
if (opts?.whitespace) {
|
|
3038
|
+
args.push('--whitespace', opts.whitespace);
|
|
3039
|
+
}
|
|
3040
|
+
if (opts?.forceRebase) {
|
|
3041
|
+
args.push('--force-rebase');
|
|
3042
|
+
}
|
|
3043
|
+
if (opts?.noFf) {
|
|
3044
|
+
args.push('--no-ff');
|
|
3045
|
+
}
|
|
3046
|
+
if (opts?.apply) {
|
|
3047
|
+
args.push('--apply');
|
|
3048
|
+
}
|
|
3049
|
+
if (opts?.rerereAutoupdate === true) {
|
|
3050
|
+
args.push('--rerere-autoupdate');
|
|
3051
|
+
}
|
|
3052
|
+
else if (opts?.rerereAutoupdate === false) {
|
|
3053
|
+
args.push('--no-rerere-autoupdate');
|
|
3054
|
+
}
|
|
3055
|
+
if (opts?.empty) {
|
|
3056
|
+
args.push('--empty', opts.empty);
|
|
3057
|
+
}
|
|
3058
|
+
if (opts?.autosquash === true) {
|
|
3059
|
+
args.push('--autosquash');
|
|
3060
|
+
}
|
|
3061
|
+
else if (opts?.autosquash === false) {
|
|
3062
|
+
args.push('--no-autosquash');
|
|
3063
|
+
}
|
|
3064
|
+
if (opts?.updateRefs === true) {
|
|
3065
|
+
args.push('--update-refs');
|
|
3066
|
+
}
|
|
3067
|
+
else if (opts?.updateRefs === false) {
|
|
3068
|
+
args.push('--no-update-refs');
|
|
3069
|
+
}
|
|
3070
|
+
if (opts?.gpgSign === true) {
|
|
3071
|
+
args.push('-S');
|
|
3072
|
+
}
|
|
3073
|
+
else if (typeof opts?.gpgSign === 'string') {
|
|
3074
|
+
args.push(`-S${opts.gpgSign}`);
|
|
3075
|
+
}
|
|
3076
|
+
if (opts?.autostash === true) {
|
|
3077
|
+
args.push('--autostash');
|
|
3078
|
+
}
|
|
3079
|
+
else if (opts?.autostash === false) {
|
|
3080
|
+
args.push('--no-autostash');
|
|
3081
|
+
}
|
|
3082
|
+
if (opts?.exec) {
|
|
3083
|
+
const execs = Array.isArray(opts.exec) ? opts.exec : [opts.exec];
|
|
3084
|
+
for (const cmd of execs) {
|
|
3085
|
+
args.push('--exec', cmd);
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
if (opts?.forkPoint === true) {
|
|
3089
|
+
args.push('--fork-point');
|
|
3090
|
+
}
|
|
3091
|
+
else if (opts?.forkPoint === false) {
|
|
3092
|
+
args.push('--no-fork-point');
|
|
3093
|
+
}
|
|
3094
|
+
if (opts?.strategy) {
|
|
3095
|
+
args.push('--strategy', opts.strategy);
|
|
3096
|
+
}
|
|
3097
|
+
if (opts?.strategyOption) {
|
|
3098
|
+
const strategyOptions = Array.isArray(opts.strategyOption)
|
|
3099
|
+
? opts.strategyOption
|
|
3100
|
+
: [opts.strategyOption];
|
|
3101
|
+
for (const so of strategyOptions) {
|
|
3102
|
+
args.push('-X', so);
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
if (opts?.root) {
|
|
3106
|
+
args.push('--root');
|
|
3107
|
+
}
|
|
3108
|
+
if (opts?.rescheduleFailedExec === true) {
|
|
3109
|
+
args.push('--reschedule-failed-exec');
|
|
3110
|
+
}
|
|
3111
|
+
else if (opts?.rescheduleFailedExec === false) {
|
|
3112
|
+
args.push('--no-reschedule-failed-exec');
|
|
3113
|
+
}
|
|
3114
|
+
if (opts?.reapplyCherryPicks === true) {
|
|
3115
|
+
args.push('--reapply-cherry-picks');
|
|
3116
|
+
}
|
|
3117
|
+
else if (opts?.reapplyCherryPicks === false) {
|
|
3118
|
+
args.push('--no-reapply-cherry-picks');
|
|
3119
|
+
}
|
|
1487
3120
|
if (opts?.upstream) {
|
|
1488
3121
|
args.push(opts.upstream);
|
|
1489
3122
|
}
|
|
@@ -1511,6 +3144,43 @@ export class WorktreeRepoImpl {
|
|
|
1511
3144
|
else if (opts?.theirs) {
|
|
1512
3145
|
args.push('--theirs');
|
|
1513
3146
|
}
|
|
3147
|
+
// New options
|
|
3148
|
+
if (opts?.ignoreUnmerged) {
|
|
3149
|
+
args.push('--ignore-unmerged');
|
|
3150
|
+
}
|
|
3151
|
+
if (opts?.overlay === true) {
|
|
3152
|
+
args.push('--overlay');
|
|
3153
|
+
}
|
|
3154
|
+
else if (opts?.overlay === false) {
|
|
3155
|
+
args.push('--no-overlay');
|
|
3156
|
+
}
|
|
3157
|
+
if (opts?.quiet) {
|
|
3158
|
+
args.push('--quiet');
|
|
3159
|
+
}
|
|
3160
|
+
if (opts?.recurseSubmodules === true) {
|
|
3161
|
+
args.push('--recurse-submodules');
|
|
3162
|
+
}
|
|
3163
|
+
else if (opts?.recurseSubmodules === false) {
|
|
3164
|
+
args.push('--no-recurse-submodules');
|
|
3165
|
+
}
|
|
3166
|
+
if (opts?.progress === true) {
|
|
3167
|
+
args.push('--progress');
|
|
3168
|
+
}
|
|
3169
|
+
else if (opts?.progress === false) {
|
|
3170
|
+
args.push('--no-progress');
|
|
3171
|
+
}
|
|
3172
|
+
if (opts?.merge) {
|
|
3173
|
+
args.push('--merge');
|
|
3174
|
+
}
|
|
3175
|
+
if (opts?.conflict) {
|
|
3176
|
+
args.push('--conflict', opts.conflict);
|
|
3177
|
+
}
|
|
3178
|
+
if (opts?.ignoreSkipWorktreeBits) {
|
|
3179
|
+
args.push('--ignore-skip-worktree-bits');
|
|
3180
|
+
}
|
|
3181
|
+
if (opts?.pathspecFromFile) {
|
|
3182
|
+
args.push('--pathspec-from-file', opts.pathspecFromFile);
|
|
3183
|
+
}
|
|
1514
3184
|
const pathList = Array.isArray(paths) ? paths : [paths];
|
|
1515
3185
|
args.push('--', ...pathList);
|
|
1516
3186
|
await this.runner.runOrThrow(this.context, args, {
|
|
@@ -1552,6 +3222,39 @@ export class WorktreeRepoImpl {
|
|
|
1552
3222
|
if (opts?.noVerify) {
|
|
1553
3223
|
args.push('--no-verify');
|
|
1554
3224
|
}
|
|
3225
|
+
// New options
|
|
3226
|
+
if (opts?.cleanup) {
|
|
3227
|
+
args.push('--cleanup', opts.cleanup);
|
|
3228
|
+
}
|
|
3229
|
+
if (opts?.signoff) {
|
|
3230
|
+
args.push('--signoff');
|
|
3231
|
+
}
|
|
3232
|
+
if (opts?.rerereAutoupdate === true) {
|
|
3233
|
+
args.push('--rerere-autoupdate');
|
|
3234
|
+
}
|
|
3235
|
+
else if (opts?.rerereAutoupdate === false) {
|
|
3236
|
+
args.push('--no-rerere-autoupdate');
|
|
3237
|
+
}
|
|
3238
|
+
if (opts?.strategy) {
|
|
3239
|
+
args.push('--strategy', opts.strategy);
|
|
3240
|
+
}
|
|
3241
|
+
if (opts?.strategyOption) {
|
|
3242
|
+
const strategyOptions = Array.isArray(opts.strategyOption)
|
|
3243
|
+
? opts.strategyOption
|
|
3244
|
+
: [opts.strategyOption];
|
|
3245
|
+
for (const so of strategyOptions) {
|
|
3246
|
+
args.push('-X', so);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
if (opts?.gpgSign === true) {
|
|
3250
|
+
args.push('-S');
|
|
3251
|
+
}
|
|
3252
|
+
else if (typeof opts?.gpgSign === 'string') {
|
|
3253
|
+
args.push(`-S${opts.gpgSign}`);
|
|
3254
|
+
}
|
|
3255
|
+
if (opts?.reference) {
|
|
3256
|
+
args.push('--reference');
|
|
3257
|
+
}
|
|
1555
3258
|
const commitList = Array.isArray(commits) ? commits : [commits];
|
|
1556
3259
|
args.push(...commitList);
|
|
1557
3260
|
await this.runner.runOrThrow(this.context, args, {
|
|
@@ -1575,6 +3278,25 @@ export class WorktreeRepoImpl {
|
|
|
1575
3278
|
if (opts?.format) {
|
|
1576
3279
|
args.push(`--format=${opts.format}`);
|
|
1577
3280
|
}
|
|
3281
|
+
// New options
|
|
3282
|
+
if (opts?.quiet) {
|
|
3283
|
+
args.push('--quiet');
|
|
3284
|
+
}
|
|
3285
|
+
if (opts?.source) {
|
|
3286
|
+
args.push('--source');
|
|
3287
|
+
}
|
|
3288
|
+
if (opts?.useMailmap) {
|
|
3289
|
+
args.push('--use-mailmap');
|
|
3290
|
+
}
|
|
3291
|
+
if (opts?.decorateRefs) {
|
|
3292
|
+
args.push('--decorate-refs', opts.decorateRefs);
|
|
3293
|
+
}
|
|
3294
|
+
if (opts?.decorateRefsExclude) {
|
|
3295
|
+
args.push('--decorate-refs-exclude', opts.decorateRefsExclude);
|
|
3296
|
+
}
|
|
3297
|
+
if (opts?.decorate) {
|
|
3298
|
+
args.push(`--decorate=${opts.decorate}`);
|
|
3299
|
+
}
|
|
1578
3300
|
args.push(object);
|
|
1579
3301
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1580
3302
|
signal: opts?.signal,
|
|
@@ -1686,17 +3408,141 @@ export class WorktreeRepoImpl {
|
|
|
1686
3408
|
if (opts?.force) {
|
|
1687
3409
|
args.push('--force');
|
|
1688
3410
|
}
|
|
3411
|
+
// New options
|
|
3412
|
+
if (opts?.noFetch) {
|
|
3413
|
+
args.push('--no-fetch');
|
|
3414
|
+
}
|
|
3415
|
+
if (opts?.checkout) {
|
|
3416
|
+
args.push('--checkout');
|
|
3417
|
+
}
|
|
3418
|
+
if (opts?.merge) {
|
|
3419
|
+
args.push('--merge');
|
|
3420
|
+
}
|
|
3421
|
+
if (opts?.rebase) {
|
|
3422
|
+
args.push('--rebase');
|
|
3423
|
+
}
|
|
3424
|
+
if (opts?.recommendShallow) {
|
|
3425
|
+
args.push('--recommend-shallow');
|
|
3426
|
+
}
|
|
3427
|
+
if (opts?.reference) {
|
|
3428
|
+
args.push(`--reference=${opts.reference}`);
|
|
3429
|
+
}
|
|
3430
|
+
if (opts?.singleBranch) {
|
|
3431
|
+
args.push('--single-branch');
|
|
3432
|
+
}
|
|
3433
|
+
if (opts?.filter) {
|
|
3434
|
+
args.push(`--filter=${opts.filter}`);
|
|
3435
|
+
}
|
|
1689
3436
|
await this.runner.runOrThrow(this.context, args, {
|
|
1690
3437
|
signal: opts?.signal,
|
|
1691
3438
|
});
|
|
1692
3439
|
}
|
|
1693
3440
|
async submoduleAdd(url, path, opts) {
|
|
1694
|
-
|
|
3441
|
+
const args = ['submodule', 'add'];
|
|
3442
|
+
if (opts?.branch) {
|
|
3443
|
+
args.push('-b', opts.branch);
|
|
3444
|
+
}
|
|
3445
|
+
if (opts?.force) {
|
|
3446
|
+
args.push('--force');
|
|
3447
|
+
}
|
|
3448
|
+
if (opts?.name) {
|
|
3449
|
+
args.push('--name', opts.name);
|
|
3450
|
+
}
|
|
3451
|
+
if (opts?.reference) {
|
|
3452
|
+
args.push('--reference', opts.reference);
|
|
3453
|
+
}
|
|
3454
|
+
if (opts?.depth !== undefined) {
|
|
3455
|
+
args.push('--depth', String(opts.depth));
|
|
3456
|
+
}
|
|
3457
|
+
args.push(url, path);
|
|
3458
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
1695
3459
|
signal: opts?.signal,
|
|
1696
3460
|
});
|
|
1697
3461
|
}
|
|
1698
3462
|
async submoduleDeinit(path, opts) {
|
|
1699
|
-
|
|
3463
|
+
const args = ['submodule', 'deinit'];
|
|
3464
|
+
if (opts?.force) {
|
|
3465
|
+
args.push('--force');
|
|
3466
|
+
}
|
|
3467
|
+
if (opts?.all) {
|
|
3468
|
+
args.push('--all');
|
|
3469
|
+
}
|
|
3470
|
+
else {
|
|
3471
|
+
args.push(path);
|
|
3472
|
+
}
|
|
3473
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3474
|
+
signal: opts?.signal,
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
async submoduleStatus(paths, opts) {
|
|
3478
|
+
const args = ['submodule', 'status'];
|
|
3479
|
+
if (opts?.recursive) {
|
|
3480
|
+
args.push('--recursive');
|
|
3481
|
+
}
|
|
3482
|
+
if (paths && paths.length > 0) {
|
|
3483
|
+
args.push('--', ...paths);
|
|
3484
|
+
}
|
|
3485
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
3486
|
+
signal: opts?.signal,
|
|
3487
|
+
});
|
|
3488
|
+
return result.stdout;
|
|
3489
|
+
}
|
|
3490
|
+
async submoduleSummary(opts) {
|
|
3491
|
+
const args = ['submodule', 'summary'];
|
|
3492
|
+
if (opts?.limit !== undefined) {
|
|
3493
|
+
args.push('-n', String(opts.limit));
|
|
3494
|
+
}
|
|
3495
|
+
if (opts?.files) {
|
|
3496
|
+
args.push('--files');
|
|
3497
|
+
}
|
|
3498
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
3499
|
+
signal: opts?.signal,
|
|
3500
|
+
});
|
|
3501
|
+
return result.stdout;
|
|
3502
|
+
}
|
|
3503
|
+
async submoduleForeach(command, opts) {
|
|
3504
|
+
const args = ['submodule', 'foreach'];
|
|
3505
|
+
if (opts?.recursive) {
|
|
3506
|
+
args.push('--recursive');
|
|
3507
|
+
}
|
|
3508
|
+
args.push(command);
|
|
3509
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
3510
|
+
signal: opts?.signal,
|
|
3511
|
+
});
|
|
3512
|
+
return result.stdout;
|
|
3513
|
+
}
|
|
3514
|
+
async submoduleSync(paths, opts) {
|
|
3515
|
+
const args = ['submodule', 'sync'];
|
|
3516
|
+
if (opts?.recursive) {
|
|
3517
|
+
args.push('--recursive');
|
|
3518
|
+
}
|
|
3519
|
+
if (paths && paths.length > 0) {
|
|
3520
|
+
args.push('--', ...paths);
|
|
3521
|
+
}
|
|
3522
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3523
|
+
signal: opts?.signal,
|
|
3524
|
+
});
|
|
3525
|
+
}
|
|
3526
|
+
async submoduleAbsorbGitDirs(opts) {
|
|
3527
|
+
await this.runner.runOrThrow(this.context, ['submodule', 'absorbgitdirs'], {
|
|
3528
|
+
signal: opts?.signal,
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
async submoduleSetBranch(path, branch, opts) {
|
|
3532
|
+
const args = ['submodule', 'set-branch'];
|
|
3533
|
+
if (opts?.default) {
|
|
3534
|
+
args.push('--default');
|
|
3535
|
+
}
|
|
3536
|
+
else {
|
|
3537
|
+
args.push('--branch', branch);
|
|
3538
|
+
}
|
|
3539
|
+
args.push('--', path);
|
|
3540
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3541
|
+
signal: opts?.signal,
|
|
3542
|
+
});
|
|
3543
|
+
}
|
|
3544
|
+
async submoduleSetUrl(path, url, opts) {
|
|
3545
|
+
await this.runner.runOrThrow(this.context, ['submodule', 'set-url', '--', path, url], {
|
|
1700
3546
|
signal: opts?.signal,
|
|
1701
3547
|
});
|
|
1702
3548
|
}
|
|
@@ -1761,6 +3607,13 @@ export class WorktreeRepoImpl {
|
|
|
1761
3607
|
else if (opts?.mirror === 'push') {
|
|
1762
3608
|
args.push('--mirror=push');
|
|
1763
3609
|
}
|
|
3610
|
+
// New option
|
|
3611
|
+
if (opts?.tags === true) {
|
|
3612
|
+
args.push('--tags');
|
|
3613
|
+
}
|
|
3614
|
+
else if (opts?.tags === false) {
|
|
3615
|
+
args.push('--no-tags');
|
|
3616
|
+
}
|
|
1764
3617
|
args.push(name, url);
|
|
1765
3618
|
await this.runner.runOrThrow(this.context, args, {
|
|
1766
3619
|
signal: opts?.signal,
|
|
@@ -1797,6 +3650,76 @@ export class WorktreeRepoImpl {
|
|
|
1797
3650
|
signal: opts?.signal,
|
|
1798
3651
|
});
|
|
1799
3652
|
}
|
|
3653
|
+
async remoteSetHead(remote, branch, opts) {
|
|
3654
|
+
const args = ['remote', 'set-head'];
|
|
3655
|
+
if (opts?.auto) {
|
|
3656
|
+
args.push('--auto');
|
|
3657
|
+
}
|
|
3658
|
+
else if (opts?.delete) {
|
|
3659
|
+
args.push('--delete');
|
|
3660
|
+
}
|
|
3661
|
+
args.push(remote);
|
|
3662
|
+
if (branch && !opts?.auto && !opts?.delete) {
|
|
3663
|
+
args.push(branch);
|
|
3664
|
+
}
|
|
3665
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3666
|
+
signal: opts?.signal,
|
|
3667
|
+
});
|
|
3668
|
+
}
|
|
3669
|
+
async remoteShow(remote, opts) {
|
|
3670
|
+
const args = ['remote', 'show'];
|
|
3671
|
+
if (opts?.noQuery) {
|
|
3672
|
+
args.push('-n');
|
|
3673
|
+
}
|
|
3674
|
+
args.push(remote);
|
|
3675
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
3676
|
+
signal: opts?.signal,
|
|
3677
|
+
});
|
|
3678
|
+
return result.stdout;
|
|
3679
|
+
}
|
|
3680
|
+
async remotePrune(remote, opts) {
|
|
3681
|
+
const args = ['remote', 'prune'];
|
|
3682
|
+
if (opts?.dryRun) {
|
|
3683
|
+
args.push('--dry-run');
|
|
3684
|
+
}
|
|
3685
|
+
args.push(remote);
|
|
3686
|
+
const result = await this.runner.runOrThrow(this.context, args, {
|
|
3687
|
+
signal: opts?.signal,
|
|
3688
|
+
});
|
|
3689
|
+
// Parse pruned refs from output
|
|
3690
|
+
const pruned = [];
|
|
3691
|
+
for (const line of parseLines(result.stdout)) {
|
|
3692
|
+
// Output is like " * [pruned] origin/some-branch"
|
|
3693
|
+
const match = line.match(/\* \[pruned\] (.+)/);
|
|
3694
|
+
const ref = match?.[1];
|
|
3695
|
+
if (ref) {
|
|
3696
|
+
pruned.push(ref);
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
return pruned;
|
|
3700
|
+
}
|
|
3701
|
+
async remoteUpdate(remotes, opts) {
|
|
3702
|
+
const args = ['remote', 'update'];
|
|
3703
|
+
if (opts?.prune) {
|
|
3704
|
+
args.push('--prune');
|
|
3705
|
+
}
|
|
3706
|
+
if (remotes && remotes.length > 0) {
|
|
3707
|
+
args.push(...remotes);
|
|
3708
|
+
}
|
|
3709
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3710
|
+
signal: opts?.signal,
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
async remoteSetBranches(remote, branches, opts) {
|
|
3714
|
+
const args = ['remote', 'set-branches'];
|
|
3715
|
+
if (opts?.add) {
|
|
3716
|
+
args.push('--add');
|
|
3717
|
+
}
|
|
3718
|
+
args.push(remote, ...branches);
|
|
3719
|
+
await this.runner.runOrThrow(this.context, args, {
|
|
3720
|
+
signal: opts?.signal,
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
1800
3723
|
// ==========================================================================
|
|
1801
3724
|
// Config Operations (Repository-level)
|
|
1802
3725
|
// ==========================================================================
|
|
@@ -1853,6 +3776,13 @@ export class WorktreeRepoImpl {
|
|
|
1853
3776
|
*/
|
|
1854
3777
|
async configGetRaw(key, opts) {
|
|
1855
3778
|
const args = ['config'];
|
|
3779
|
+
// New options
|
|
3780
|
+
if (opts?.type) {
|
|
3781
|
+
args.push(`--type=${opts.type}`);
|
|
3782
|
+
}
|
|
3783
|
+
if (opts?.default !== undefined) {
|
|
3784
|
+
args.push('--default', opts.default);
|
|
3785
|
+
}
|
|
1856
3786
|
if (opts?.all) {
|
|
1857
3787
|
args.push('--get-all');
|
|
1858
3788
|
}
|
|
@@ -1903,6 +3833,13 @@ export class WorktreeRepoImpl {
|
|
|
1903
3833
|
if (opts?.showScope) {
|
|
1904
3834
|
args.push('--show-scope');
|
|
1905
3835
|
}
|
|
3836
|
+
// New options
|
|
3837
|
+
if (opts?.includes) {
|
|
3838
|
+
args.push('--includes');
|
|
3839
|
+
}
|
|
3840
|
+
if (opts?.nameOnly) {
|
|
3841
|
+
args.push('--name-only');
|
|
3842
|
+
}
|
|
1906
3843
|
const result = await this.runner.runOrThrow(this.context, args, {
|
|
1907
3844
|
signal: opts?.signal,
|
|
1908
3845
|
});
|
|
@@ -1917,15 +3854,34 @@ export class WorktreeRepoImpl {
|
|
|
1917
3854
|
keyValue = line.slice(tabIndex + 1);
|
|
1918
3855
|
}
|
|
1919
3856
|
}
|
|
1920
|
-
|
|
1921
|
-
if (
|
|
3857
|
+
// For nameOnly, there's no '=' separator
|
|
3858
|
+
if (opts?.nameOnly) {
|
|
1922
3859
|
entries.push({
|
|
1923
|
-
key: keyValue
|
|
1924
|
-
value:
|
|
3860
|
+
key: keyValue,
|
|
3861
|
+
value: '',
|
|
1925
3862
|
});
|
|
1926
3863
|
}
|
|
3864
|
+
else {
|
|
3865
|
+
const eqIndex = keyValue.indexOf('=');
|
|
3866
|
+
if (eqIndex !== -1) {
|
|
3867
|
+
entries.push({
|
|
3868
|
+
key: keyValue.slice(0, eqIndex),
|
|
3869
|
+
value: keyValue.slice(eqIndex + 1),
|
|
3870
|
+
});
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
1927
3873
|
}
|
|
1928
3874
|
return entries;
|
|
1929
3875
|
}
|
|
3876
|
+
async configRenameSection(oldName, newName, opts) {
|
|
3877
|
+
await this.runner.runOrThrow(this.context, ['config', '--rename-section', oldName, newName], {
|
|
3878
|
+
signal: opts?.signal,
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
async configRemoveSection(name, opts) {
|
|
3882
|
+
await this.runner.runOrThrow(this.context, ['config', '--remove-section', name], {
|
|
3883
|
+
signal: opts?.signal,
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
1930
3886
|
}
|
|
1931
3887
|
//# sourceMappingURL=worktree-repo-impl.js.map
|