isomorphic-git 1.35.1 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +334 -147
- package/index.js +334 -147
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/models/index.cjs +1 -0
- package/models/index.js +1 -0
- package/models/index.umd.min.js +1 -1
- package/models/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -4830,6 +4830,7 @@ function isPromiseFs(fs) {
|
|
|
4830
4830
|
// List of commands all filesystems are expected to provide. `rm` is not
|
|
4831
4831
|
// included since it may not exist and must be handled as a special case
|
|
4832
4832
|
const commands = [
|
|
4833
|
+
'cp',
|
|
4833
4834
|
'readFile',
|
|
4834
4835
|
'writeFile',
|
|
4835
4836
|
'mkdir',
|
|
@@ -5122,6 +5123,51 @@ function assertParameter(name, value) {
|
|
|
5122
5123
|
}
|
|
5123
5124
|
}
|
|
5124
5125
|
|
|
5126
|
+
/**
|
|
5127
|
+
* discoverGitdir
|
|
5128
|
+
*
|
|
5129
|
+
* When processing git commands on a submodule determine
|
|
5130
|
+
* the actual git directory based on the contents of the .git file.
|
|
5131
|
+
*
|
|
5132
|
+
* Otherwise (if sent a directory) return that directory as-is.
|
|
5133
|
+
*
|
|
5134
|
+
* A decision has to be made "in what layer will submodules be interpreted,
|
|
5135
|
+
* and then after that, where can the code can just stay exactly the same as before."
|
|
5136
|
+
* This implementation processes submodules in the front-end location of src/api/.
|
|
5137
|
+
* The backend of src/commands/ isn't modified. This keeps a clear division
|
|
5138
|
+
* of responsibilities and should be maintained.
|
|
5139
|
+
*
|
|
5140
|
+
* A consequence is that __tests__ must occasionally be informed
|
|
5141
|
+
* about submodules also, since those call src/commands/ directly.
|
|
5142
|
+
*
|
|
5143
|
+
*
|
|
5144
|
+
*/
|
|
5145
|
+
|
|
5146
|
+
async function discoverGitdir({ fsp, dotgit }) {
|
|
5147
|
+
assertParameter('fsp', fsp);
|
|
5148
|
+
assertParameter('dotgit', dotgit);
|
|
5149
|
+
|
|
5150
|
+
const dotgitStat = await fsp
|
|
5151
|
+
._stat(dotgit)
|
|
5152
|
+
.catch(() => ({ isFile: () => false, isDirectory: () => false }));
|
|
5153
|
+
if (dotgitStat.isDirectory()) {
|
|
5154
|
+
return dotgit
|
|
5155
|
+
} else if (dotgitStat.isFile()) {
|
|
5156
|
+
return fsp
|
|
5157
|
+
._readFile(dotgit, 'utf8')
|
|
5158
|
+
.then(contents => contents.trimRight().substr(8))
|
|
5159
|
+
.then(submoduleGitdir => {
|
|
5160
|
+
const gitdir = join(dirname(dotgit), submoduleGitdir);
|
|
5161
|
+
return gitdir
|
|
5162
|
+
})
|
|
5163
|
+
} else {
|
|
5164
|
+
// Neither a file nor a directory. This correlates to a "git init" scenario where it's empty.
|
|
5165
|
+
// This is the expected result for normal repos, and indeterminate for submodules, but
|
|
5166
|
+
// would be unusual with submodules.
|
|
5167
|
+
return dotgit
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
|
|
5125
5171
|
// @ts-check
|
|
5126
5172
|
/**
|
|
5127
5173
|
*
|
|
@@ -5188,8 +5234,9 @@ async function abortMerge({
|
|
|
5188
5234
|
const trees = [TREE({ ref: commit }), WORKDIR(), STAGE()];
|
|
5189
5235
|
let unmergedPaths = [];
|
|
5190
5236
|
|
|
5237
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
5191
5238
|
await GitIndexManager.acquire(
|
|
5192
|
-
{ fs, gitdir, cache },
|
|
5239
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
5193
5240
|
async function (index) {
|
|
5194
5241
|
unmergedPaths = index.unmergedPaths;
|
|
5195
5242
|
}
|
|
@@ -5199,7 +5246,7 @@ async function abortMerge({
|
|
|
5199
5246
|
fs,
|
|
5200
5247
|
cache,
|
|
5201
5248
|
dir,
|
|
5202
|
-
gitdir,
|
|
5249
|
+
gitdir: updatedGitdir,
|
|
5203
5250
|
trees,
|
|
5204
5251
|
map: async function (path, [head, workdir, index]) {
|
|
5205
5252
|
const staged = !(await modified(workdir, index));
|
|
@@ -5224,7 +5271,7 @@ async function abortMerge({
|
|
|
5224
5271
|
});
|
|
5225
5272
|
|
|
5226
5273
|
await GitIndexManager.acquire(
|
|
5227
|
-
{ fs, gitdir, cache },
|
|
5274
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
5228
5275
|
async function (index) {
|
|
5229
5276
|
// Reset paths in index and worktree, this can't be done in _walk because the
|
|
5230
5277
|
// STAGE walker acquires its own index lock.
|
|
@@ -5437,20 +5484,24 @@ async function add({
|
|
|
5437
5484
|
assertParameter('filepath', filepath);
|
|
5438
5485
|
|
|
5439
5486
|
const fs = new FileSystem(_fs);
|
|
5440
|
-
await
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5487
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
5488
|
+
await GitIndexManager.acquire(
|
|
5489
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
5490
|
+
async index => {
|
|
5491
|
+
const config = await GitConfigManager.get({ fs, gitdir: updatedGitdir });
|
|
5492
|
+
const autocrlf = await config.get('core.autocrlf');
|
|
5493
|
+
return addToIndex({
|
|
5494
|
+
dir,
|
|
5495
|
+
gitdir: updatedGitdir,
|
|
5496
|
+
fs,
|
|
5497
|
+
filepath,
|
|
5498
|
+
index,
|
|
5499
|
+
force,
|
|
5500
|
+
parallel,
|
|
5501
|
+
autocrlf,
|
|
5502
|
+
})
|
|
5503
|
+
}
|
|
5504
|
+
);
|
|
5454
5505
|
} catch (err) {
|
|
5455
5506
|
err.caller = 'git.add';
|
|
5456
5507
|
throw err
|
|
@@ -6209,11 +6260,12 @@ async function addNote({
|
|
|
6209
6260
|
});
|
|
6210
6261
|
if (!committer) throw new MissingNameError('committer')
|
|
6211
6262
|
|
|
6263
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
6212
6264
|
return await _addNote({
|
|
6213
|
-
fs
|
|
6265
|
+
fs,
|
|
6214
6266
|
cache,
|
|
6215
6267
|
onSign,
|
|
6216
|
-
gitdir,
|
|
6268
|
+
gitdir: updatedGitdir,
|
|
6217
6269
|
ref,
|
|
6218
6270
|
oid,
|
|
6219
6271
|
note,
|
|
@@ -6319,9 +6371,11 @@ async function addRemote({
|
|
|
6319
6371
|
assertParameter('gitdir', gitdir);
|
|
6320
6372
|
assertParameter('remote', remote);
|
|
6321
6373
|
assertParameter('url', url);
|
|
6374
|
+
const fsp = new FileSystem(fs);
|
|
6375
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
6322
6376
|
return await _addRemote({
|
|
6323
|
-
fs:
|
|
6324
|
-
gitdir,
|
|
6377
|
+
fs: fsp,
|
|
6378
|
+
gitdir: updatedGitdir,
|
|
6325
6379
|
remote,
|
|
6326
6380
|
url,
|
|
6327
6381
|
force,
|
|
@@ -6478,16 +6532,21 @@ async function annotatedTag({
|
|
|
6478
6532
|
assertParameter('onSign', onSign);
|
|
6479
6533
|
}
|
|
6480
6534
|
const fs = new FileSystem(_fs);
|
|
6535
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
6481
6536
|
|
|
6482
6537
|
// Fill in missing arguments with default values
|
|
6483
|
-
const tagger = await normalizeAuthorObject({
|
|
6538
|
+
const tagger = await normalizeAuthorObject({
|
|
6539
|
+
fs,
|
|
6540
|
+
gitdir: updatedGitdir,
|
|
6541
|
+
author: _tagger,
|
|
6542
|
+
});
|
|
6484
6543
|
if (!tagger) throw new MissingNameError('tagger')
|
|
6485
6544
|
|
|
6486
6545
|
return await _annotatedTag({
|
|
6487
6546
|
fs,
|
|
6488
6547
|
cache,
|
|
6489
6548
|
onSign,
|
|
6490
|
-
gitdir,
|
|
6549
|
+
gitdir: updatedGitdir,
|
|
6491
6550
|
ref,
|
|
6492
6551
|
tagger,
|
|
6493
6552
|
message,
|
|
@@ -6601,9 +6660,11 @@ async function branch({
|
|
|
6601
6660
|
assertParameter('fs', fs);
|
|
6602
6661
|
assertParameter('gitdir', gitdir);
|
|
6603
6662
|
assertParameter('ref', ref);
|
|
6663
|
+
const fsp = new FileSystem(fs);
|
|
6664
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
6604
6665
|
return await _branch({
|
|
6605
|
-
fs:
|
|
6606
|
-
gitdir,
|
|
6666
|
+
fs: fsp,
|
|
6667
|
+
gitdir: updatedGitdir,
|
|
6607
6668
|
ref,
|
|
6608
6669
|
object,
|
|
6609
6670
|
checkout,
|
|
@@ -7436,13 +7497,15 @@ async function checkout({
|
|
|
7436
7497
|
assertParameter('gitdir', gitdir);
|
|
7437
7498
|
|
|
7438
7499
|
const ref = _ref || 'HEAD';
|
|
7500
|
+
const fsp = new FileSystem(fs);
|
|
7501
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
7439
7502
|
return await _checkout({
|
|
7440
|
-
fs:
|
|
7503
|
+
fs: fsp,
|
|
7441
7504
|
cache,
|
|
7442
7505
|
onProgress,
|
|
7443
7506
|
onPostCheckout,
|
|
7444
7507
|
dir,
|
|
7445
|
-
gitdir,
|
|
7508
|
+
gitdir: updatedGitdir,
|
|
7446
7509
|
remote,
|
|
7447
7510
|
ref,
|
|
7448
7511
|
filepaths,
|
|
@@ -8191,8 +8254,8 @@ function filterCapabilities(server, client) {
|
|
|
8191
8254
|
|
|
8192
8255
|
const pkg = {
|
|
8193
8256
|
name: 'isomorphic-git',
|
|
8194
|
-
version: '1.
|
|
8195
|
-
agent: 'git/isomorphic-git@1.
|
|
8257
|
+
version: '1.36.0',
|
|
8258
|
+
agent: 'git/isomorphic-git@1.36.0',
|
|
8196
8259
|
};
|
|
8197
8260
|
|
|
8198
8261
|
class FIFO {
|
|
@@ -9120,8 +9183,10 @@ async function clone({
|
|
|
9120
9183
|
}
|
|
9121
9184
|
assertParameter('url', url);
|
|
9122
9185
|
|
|
9186
|
+
const fsp = new FileSystem(fs);
|
|
9187
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9123
9188
|
return await _clone({
|
|
9124
|
-
fs:
|
|
9189
|
+
fs: fsp,
|
|
9125
9190
|
cache,
|
|
9126
9191
|
http,
|
|
9127
9192
|
onProgress,
|
|
@@ -9131,7 +9196,7 @@ async function clone({
|
|
|
9131
9196
|
onAuthFailure,
|
|
9132
9197
|
onPostCheckout,
|
|
9133
9198
|
dir,
|
|
9134
|
-
gitdir,
|
|
9199
|
+
gitdir: updatedGitdir,
|
|
9135
9200
|
url,
|
|
9136
9201
|
corsProxy,
|
|
9137
9202
|
ref,
|
|
@@ -9223,12 +9288,13 @@ async function commit({
|
|
|
9223
9288
|
assertParameter('onSign', onSign);
|
|
9224
9289
|
}
|
|
9225
9290
|
const fs = new FileSystem(_fs);
|
|
9291
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
9226
9292
|
|
|
9227
9293
|
return await _commit({
|
|
9228
9294
|
fs,
|
|
9229
9295
|
cache,
|
|
9230
9296
|
onSign,
|
|
9231
|
-
gitdir,
|
|
9297
|
+
gitdir: updatedGitdir,
|
|
9232
9298
|
message,
|
|
9233
9299
|
author,
|
|
9234
9300
|
committer,
|
|
@@ -9280,9 +9346,11 @@ async function currentBranch({
|
|
|
9280
9346
|
try {
|
|
9281
9347
|
assertParameter('fs', fs);
|
|
9282
9348
|
assertParameter('gitdir', gitdir);
|
|
9349
|
+
const fsp = new FileSystem(fs);
|
|
9350
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9283
9351
|
return await _currentBranch({
|
|
9284
|
-
fs:
|
|
9285
|
-
gitdir,
|
|
9352
|
+
fs: fsp,
|
|
9353
|
+
gitdir: updatedGitdir,
|
|
9286
9354
|
fullname,
|
|
9287
9355
|
test,
|
|
9288
9356
|
})
|
|
@@ -9356,9 +9424,11 @@ async function deleteBranch({
|
|
|
9356
9424
|
try {
|
|
9357
9425
|
assertParameter('fs', fs);
|
|
9358
9426
|
assertParameter('ref', ref);
|
|
9427
|
+
const fsp = new FileSystem(fs);
|
|
9428
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9359
9429
|
return await _deleteBranch({
|
|
9360
|
-
fs:
|
|
9361
|
-
gitdir,
|
|
9430
|
+
fs: fsp,
|
|
9431
|
+
gitdir: updatedGitdir,
|
|
9362
9432
|
ref,
|
|
9363
9433
|
})
|
|
9364
9434
|
} catch (err) {
|
|
@@ -9389,7 +9459,9 @@ async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
|
9389
9459
|
try {
|
|
9390
9460
|
assertParameter('fs', fs);
|
|
9391
9461
|
assertParameter('ref', ref);
|
|
9392
|
-
|
|
9462
|
+
const fsp = new FileSystem(fs);
|
|
9463
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9464
|
+
await GitRefManager.deleteRef({ fs: fsp, gitdir: updatedGitdir, ref });
|
|
9393
9465
|
} catch (err) {
|
|
9394
9466
|
err.caller = 'git.deleteRef';
|
|
9395
9467
|
throw err
|
|
@@ -9439,9 +9511,11 @@ async function deleteRemote({
|
|
|
9439
9511
|
try {
|
|
9440
9512
|
assertParameter('fs', fs);
|
|
9441
9513
|
assertParameter('remote', remote);
|
|
9514
|
+
const fsp = new FileSystem(fs);
|
|
9515
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9442
9516
|
return await _deleteRemote({
|
|
9443
|
-
fs:
|
|
9444
|
-
gitdir,
|
|
9517
|
+
fs: fsp,
|
|
9518
|
+
gitdir: updatedGitdir,
|
|
9445
9519
|
remote,
|
|
9446
9520
|
})
|
|
9447
9521
|
} catch (err) {
|
|
@@ -9494,9 +9568,11 @@ async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
|
9494
9568
|
try {
|
|
9495
9569
|
assertParameter('fs', fs);
|
|
9496
9570
|
assertParameter('ref', ref);
|
|
9571
|
+
const fsp = new FileSystem(fs);
|
|
9572
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9497
9573
|
return await _deleteTag({
|
|
9498
|
-
fs:
|
|
9499
|
-
gitdir,
|
|
9574
|
+
fs: fsp,
|
|
9575
|
+
gitdir: updatedGitdir,
|
|
9500
9576
|
ref,
|
|
9501
9577
|
})
|
|
9502
9578
|
} catch (err) {
|
|
@@ -9600,10 +9676,12 @@ async function expandOid({
|
|
|
9600
9676
|
assertParameter('fs', fs);
|
|
9601
9677
|
assertParameter('gitdir', gitdir);
|
|
9602
9678
|
assertParameter('oid', oid);
|
|
9679
|
+
const fsp = new FileSystem(fs);
|
|
9680
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9603
9681
|
return await _expandOid({
|
|
9604
|
-
fs:
|
|
9682
|
+
fs: fsp,
|
|
9605
9683
|
cache,
|
|
9606
|
-
gitdir,
|
|
9684
|
+
gitdir: updatedGitdir,
|
|
9607
9685
|
oid,
|
|
9608
9686
|
})
|
|
9609
9687
|
} catch (err) {
|
|
@@ -9635,9 +9713,11 @@ async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
|
9635
9713
|
assertParameter('fs', fs);
|
|
9636
9714
|
assertParameter('gitdir', gitdir);
|
|
9637
9715
|
assertParameter('ref', ref);
|
|
9716
|
+
const fsp = new FileSystem(fs);
|
|
9717
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
9638
9718
|
return await GitRefManager.expand({
|
|
9639
|
-
fs:
|
|
9640
|
-
gitdir,
|
|
9719
|
+
fs: fsp,
|
|
9720
|
+
gitdir: updatedGitdir,
|
|
9641
9721
|
ref,
|
|
9642
9722
|
})
|
|
9643
9723
|
} catch (err) {
|
|
@@ -10514,8 +10594,10 @@ async function fastForward({
|
|
|
10514
10594
|
timezoneOffset: 0,
|
|
10515
10595
|
};
|
|
10516
10596
|
|
|
10597
|
+
const fsp = new FileSystem(fs);
|
|
10598
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
10517
10599
|
return await _pull({
|
|
10518
|
-
fs:
|
|
10600
|
+
fs: fsp,
|
|
10519
10601
|
cache,
|
|
10520
10602
|
http,
|
|
10521
10603
|
onProgress,
|
|
@@ -10524,7 +10606,7 @@ async function fastForward({
|
|
|
10524
10606
|
onAuthSuccess,
|
|
10525
10607
|
onAuthFailure,
|
|
10526
10608
|
dir,
|
|
10527
|
-
gitdir,
|
|
10609
|
+
gitdir: updatedGitdir,
|
|
10528
10610
|
ref,
|
|
10529
10611
|
url,
|
|
10530
10612
|
remote,
|
|
@@ -10633,8 +10715,10 @@ async function fetch({
|
|
|
10633
10715
|
assertParameter('http', http);
|
|
10634
10716
|
assertParameter('gitdir', gitdir);
|
|
10635
10717
|
|
|
10718
|
+
const fsp = new FileSystem(fs);
|
|
10719
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
10636
10720
|
return await _fetch({
|
|
10637
|
-
fs:
|
|
10721
|
+
fs: fsp,
|
|
10638
10722
|
cache,
|
|
10639
10723
|
http,
|
|
10640
10724
|
onProgress,
|
|
@@ -10642,7 +10726,7 @@ async function fetch({
|
|
|
10642
10726
|
onAuth,
|
|
10643
10727
|
onAuthSuccess,
|
|
10644
10728
|
onAuthFailure,
|
|
10645
|
-
gitdir,
|
|
10729
|
+
gitdir: updatedGitdir,
|
|
10646
10730
|
ref,
|
|
10647
10731
|
remote,
|
|
10648
10732
|
remoteRef,
|
|
@@ -10689,10 +10773,12 @@ async function findMergeBase({
|
|
|
10689
10773
|
assertParameter('gitdir', gitdir);
|
|
10690
10774
|
assertParameter('oids', oids);
|
|
10691
10775
|
|
|
10776
|
+
const fsp = new FileSystem(fs);
|
|
10777
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
10692
10778
|
return await _findMergeBase({
|
|
10693
|
-
fs:
|
|
10779
|
+
fs: fsp,
|
|
10694
10780
|
cache,
|
|
10695
|
-
gitdir,
|
|
10781
|
+
gitdir: updatedGitdir,
|
|
10696
10782
|
oids,
|
|
10697
10783
|
})
|
|
10698
10784
|
} catch (err) {
|
|
@@ -10793,9 +10879,11 @@ async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {
|
|
|
10793
10879
|
assertParameter('gitdir', gitdir);
|
|
10794
10880
|
assertParameter('path', path);
|
|
10795
10881
|
|
|
10882
|
+
const fsp = new FileSystem(fs);
|
|
10883
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
10796
10884
|
return await _getConfig({
|
|
10797
|
-
fs:
|
|
10798
|
-
gitdir,
|
|
10885
|
+
fs: fsp,
|
|
10886
|
+
gitdir: updatedGitdir,
|
|
10799
10887
|
path,
|
|
10800
10888
|
})
|
|
10801
10889
|
} catch (err) {
|
|
@@ -10849,9 +10937,11 @@ async function getConfigAll({
|
|
|
10849
10937
|
assertParameter('gitdir', gitdir);
|
|
10850
10938
|
assertParameter('path', path);
|
|
10851
10939
|
|
|
10940
|
+
const fsp = new FileSystem(fs);
|
|
10941
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
10852
10942
|
return await _getConfigAll({
|
|
10853
|
-
fs:
|
|
10854
|
-
gitdir,
|
|
10943
|
+
fs: fsp,
|
|
10944
|
+
gitdir: updatedGitdir,
|
|
10855
10945
|
path,
|
|
10856
10946
|
})
|
|
10857
10947
|
} catch (err) {
|
|
@@ -11270,12 +11360,14 @@ async function indexPack({
|
|
|
11270
11360
|
assertParameter('gitdir', dir);
|
|
11271
11361
|
assertParameter('filepath', filepath);
|
|
11272
11362
|
|
|
11363
|
+
const fsp = new FileSystem(fs);
|
|
11364
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11273
11365
|
return await _indexPack({
|
|
11274
|
-
fs:
|
|
11366
|
+
fs: fsp,
|
|
11275
11367
|
cache,
|
|
11276
11368
|
onProgress,
|
|
11277
11369
|
dir,
|
|
11278
|
-
gitdir,
|
|
11370
|
+
gitdir: updatedGitdir,
|
|
11279
11371
|
filepath,
|
|
11280
11372
|
})
|
|
11281
11373
|
} catch (err) {
|
|
@@ -11316,11 +11408,13 @@ async function init({
|
|
|
11316
11408
|
assertParameter('dir', dir);
|
|
11317
11409
|
}
|
|
11318
11410
|
|
|
11411
|
+
const fsp = new FileSystem(fs);
|
|
11412
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11319
11413
|
return await _init({
|
|
11320
|
-
fs:
|
|
11414
|
+
fs: fsp,
|
|
11321
11415
|
bare,
|
|
11322
11416
|
dir,
|
|
11323
|
-
gitdir,
|
|
11417
|
+
gitdir: updatedGitdir,
|
|
11324
11418
|
defaultBranch,
|
|
11325
11419
|
})
|
|
11326
11420
|
} catch (err) {
|
|
@@ -11439,10 +11533,12 @@ async function isDescendent({
|
|
|
11439
11533
|
assertParameter('oid', oid);
|
|
11440
11534
|
assertParameter('ancestor', ancestor);
|
|
11441
11535
|
|
|
11536
|
+
const fsp = new FileSystem(fs);
|
|
11537
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11442
11538
|
return await _isDescendent({
|
|
11443
|
-
fs:
|
|
11539
|
+
fs: fsp,
|
|
11444
11540
|
cache,
|
|
11445
|
-
gitdir,
|
|
11541
|
+
gitdir: updatedGitdir,
|
|
11446
11542
|
oid,
|
|
11447
11543
|
ancestor,
|
|
11448
11544
|
depth,
|
|
@@ -11482,10 +11578,12 @@ async function isIgnored({
|
|
|
11482
11578
|
assertParameter('gitdir', gitdir);
|
|
11483
11579
|
assertParameter('filepath', filepath);
|
|
11484
11580
|
|
|
11581
|
+
const fsp = new FileSystem(fs);
|
|
11582
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11485
11583
|
return GitIgnoreManager.isIgnored({
|
|
11486
|
-
fs:
|
|
11584
|
+
fs: fsp,
|
|
11487
11585
|
dir,
|
|
11488
|
-
gitdir,
|
|
11586
|
+
gitdir: updatedGitdir,
|
|
11489
11587
|
filepath,
|
|
11490
11588
|
})
|
|
11491
11589
|
} catch (err) {
|
|
@@ -11533,9 +11631,11 @@ async function listBranches({
|
|
|
11533
11631
|
assertParameter('fs', fs);
|
|
11534
11632
|
assertParameter('gitdir', gitdir);
|
|
11535
11633
|
|
|
11634
|
+
const fsp = new FileSystem(fs);
|
|
11635
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11536
11636
|
return GitRefManager.listBranches({
|
|
11537
|
-
fs:
|
|
11538
|
-
gitdir,
|
|
11637
|
+
fs: fsp,
|
|
11638
|
+
gitdir: updatedGitdir,
|
|
11539
11639
|
remote,
|
|
11540
11640
|
})
|
|
11541
11641
|
} catch (err) {
|
|
@@ -11641,10 +11741,12 @@ async function listFiles({
|
|
|
11641
11741
|
assertParameter('fs', fs);
|
|
11642
11742
|
assertParameter('gitdir', gitdir);
|
|
11643
11743
|
|
|
11744
|
+
const fsp = new FileSystem(fs);
|
|
11745
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11644
11746
|
return await _listFiles({
|
|
11645
|
-
fs:
|
|
11747
|
+
fs: fsp,
|
|
11646
11748
|
cache,
|
|
11647
|
-
gitdir,
|
|
11749
|
+
gitdir: updatedGitdir,
|
|
11648
11750
|
ref,
|
|
11649
11751
|
})
|
|
11650
11752
|
} catch (err) {
|
|
@@ -11721,10 +11823,12 @@ async function listNotes({
|
|
|
11721
11823
|
assertParameter('gitdir', gitdir);
|
|
11722
11824
|
assertParameter('ref', ref);
|
|
11723
11825
|
|
|
11826
|
+
const fsp = new FileSystem(fs);
|
|
11827
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11724
11828
|
return await _listNotes({
|
|
11725
|
-
fs:
|
|
11829
|
+
fs: fsp,
|
|
11726
11830
|
cache,
|
|
11727
|
-
gitdir,
|
|
11831
|
+
gitdir: updatedGitdir,
|
|
11728
11832
|
ref,
|
|
11729
11833
|
})
|
|
11730
11834
|
} catch (err) {
|
|
@@ -11760,7 +11864,9 @@ async function listRefs({
|
|
|
11760
11864
|
try {
|
|
11761
11865
|
assertParameter('fs', fs);
|
|
11762
11866
|
assertParameter('gitdir', gitdir);
|
|
11763
|
-
|
|
11867
|
+
const fsp = new FileSystem(fs);
|
|
11868
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11869
|
+
return GitRefManager.listRefs({ fs: fsp, gitdir: updatedGitdir, filepath })
|
|
11764
11870
|
} catch (err) {
|
|
11765
11871
|
err.caller = 'git.listRefs';
|
|
11766
11872
|
throw err
|
|
@@ -11810,9 +11916,11 @@ async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
|
11810
11916
|
assertParameter('fs', fs);
|
|
11811
11917
|
assertParameter('gitdir', gitdir);
|
|
11812
11918
|
|
|
11919
|
+
const fsp = new FileSystem(fs);
|
|
11920
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
11813
11921
|
return await _listRemotes({
|
|
11814
|
-
fs:
|
|
11815
|
-
gitdir,
|
|
11922
|
+
fs: fsp,
|
|
11923
|
+
gitdir: updatedGitdir,
|
|
11816
11924
|
})
|
|
11817
11925
|
} catch (err) {
|
|
11818
11926
|
err.caller = 'git.listRemotes';
|
|
@@ -12053,7 +12161,9 @@ async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
|
12053
12161
|
try {
|
|
12054
12162
|
assertParameter('fs', fs);
|
|
12055
12163
|
assertParameter('gitdir', gitdir);
|
|
12056
|
-
|
|
12164
|
+
const fsp = new FileSystem(fs);
|
|
12165
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
12166
|
+
return GitRefManager.listTags({ fs: fsp, gitdir: updatedGitdir })
|
|
12057
12167
|
} catch (err) {
|
|
12058
12168
|
err.caller = 'git.listTags';
|
|
12059
12169
|
throw err
|
|
@@ -12348,10 +12458,12 @@ async function log({
|
|
|
12348
12458
|
assertParameter('gitdir', gitdir);
|
|
12349
12459
|
assertParameter('ref', ref);
|
|
12350
12460
|
|
|
12461
|
+
const fsp = new FileSystem(fs);
|
|
12462
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
12351
12463
|
return await _log({
|
|
12352
|
-
fs:
|
|
12464
|
+
fs: fsp,
|
|
12353
12465
|
cache,
|
|
12354
|
-
gitdir,
|
|
12466
|
+
gitdir: updatedGitdir,
|
|
12355
12467
|
filepath,
|
|
12356
12468
|
ref,
|
|
12357
12469
|
depth,
|
|
@@ -12505,15 +12617,20 @@ async function merge({
|
|
|
12505
12617
|
assertParameter('onSign', onSign);
|
|
12506
12618
|
}
|
|
12507
12619
|
const fs = new FileSystem(_fs);
|
|
12620
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
12508
12621
|
|
|
12509
|
-
const author = await normalizeAuthorObject({
|
|
12622
|
+
const author = await normalizeAuthorObject({
|
|
12623
|
+
fs,
|
|
12624
|
+
gitdir: updatedGitdir,
|
|
12625
|
+
author: _author,
|
|
12626
|
+
});
|
|
12510
12627
|
if (!author && (!fastForwardOnly || !fastForward)) {
|
|
12511
12628
|
throw new MissingNameError('author')
|
|
12512
12629
|
}
|
|
12513
12630
|
|
|
12514
12631
|
const committer = await normalizeCommitterObject({
|
|
12515
12632
|
fs,
|
|
12516
|
-
gitdir,
|
|
12633
|
+
gitdir: updatedGitdir,
|
|
12517
12634
|
author,
|
|
12518
12635
|
committer: _committer,
|
|
12519
12636
|
});
|
|
@@ -12525,7 +12642,7 @@ async function merge({
|
|
|
12525
12642
|
fs,
|
|
12526
12643
|
cache,
|
|
12527
12644
|
dir,
|
|
12528
|
-
gitdir,
|
|
12645
|
+
gitdir: updatedGitdir,
|
|
12529
12646
|
ours,
|
|
12530
12647
|
theirs,
|
|
12531
12648
|
fastForward,
|
|
@@ -12702,10 +12819,12 @@ async function packObjects({
|
|
|
12702
12819
|
assertParameter('gitdir', gitdir);
|
|
12703
12820
|
assertParameter('oids', oids);
|
|
12704
12821
|
|
|
12822
|
+
const fsp = new FileSystem(fs);
|
|
12823
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
12705
12824
|
return await _packObjects({
|
|
12706
|
-
fs:
|
|
12825
|
+
fs: fsp,
|
|
12707
12826
|
cache,
|
|
12708
|
-
gitdir,
|
|
12827
|
+
gitdir: updatedGitdir,
|
|
12709
12828
|
oids,
|
|
12710
12829
|
write,
|
|
12711
12830
|
})
|
|
@@ -12798,13 +12917,18 @@ async function pull({
|
|
|
12798
12917
|
assertParameter('gitdir', gitdir);
|
|
12799
12918
|
|
|
12800
12919
|
const fs = new FileSystem(_fs);
|
|
12920
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
12801
12921
|
|
|
12802
|
-
const author = await normalizeAuthorObject({
|
|
12922
|
+
const author = await normalizeAuthorObject({
|
|
12923
|
+
fs,
|
|
12924
|
+
gitdir: updatedGitdir,
|
|
12925
|
+
author: _author,
|
|
12926
|
+
});
|
|
12803
12927
|
if (!author) throw new MissingNameError('author')
|
|
12804
12928
|
|
|
12805
12929
|
const committer = await normalizeCommitterObject({
|
|
12806
12930
|
fs,
|
|
12807
|
-
gitdir,
|
|
12931
|
+
gitdir: updatedGitdir,
|
|
12808
12932
|
author,
|
|
12809
12933
|
committer: _committer,
|
|
12810
12934
|
});
|
|
@@ -12820,7 +12944,7 @@ async function pull({
|
|
|
12820
12944
|
onAuthSuccess,
|
|
12821
12945
|
onAuthFailure,
|
|
12822
12946
|
dir,
|
|
12823
|
-
gitdir,
|
|
12947
|
+
gitdir: updatedGitdir,
|
|
12824
12948
|
ref,
|
|
12825
12949
|
url,
|
|
12826
12950
|
remote,
|
|
@@ -13382,8 +13506,10 @@ async function push({
|
|
|
13382
13506
|
assertParameter('http', http);
|
|
13383
13507
|
assertParameter('gitdir', gitdir);
|
|
13384
13508
|
|
|
13509
|
+
const fsp = new FileSystem(fs);
|
|
13510
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
13385
13511
|
return await _push({
|
|
13386
|
-
fs:
|
|
13512
|
+
fs: fsp,
|
|
13387
13513
|
cache,
|
|
13388
13514
|
http,
|
|
13389
13515
|
onProgress,
|
|
@@ -13392,7 +13518,7 @@ async function push({
|
|
|
13392
13518
|
onAuthSuccess,
|
|
13393
13519
|
onAuthFailure,
|
|
13394
13520
|
onPrePush,
|
|
13395
|
-
gitdir,
|
|
13521
|
+
gitdir: updatedGitdir,
|
|
13396
13522
|
ref,
|
|
13397
13523
|
remoteRef,
|
|
13398
13524
|
remote,
|
|
@@ -13511,10 +13637,12 @@ async function readBlob({
|
|
|
13511
13637
|
assertParameter('gitdir', gitdir);
|
|
13512
13638
|
assertParameter('oid', oid);
|
|
13513
13639
|
|
|
13640
|
+
const fsp = new FileSystem(fs);
|
|
13641
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
13514
13642
|
return await _readBlob({
|
|
13515
|
-
fs:
|
|
13643
|
+
fs: fsp,
|
|
13516
13644
|
cache,
|
|
13517
|
-
gitdir,
|
|
13645
|
+
gitdir: updatedGitdir,
|
|
13518
13646
|
oid,
|
|
13519
13647
|
filepath,
|
|
13520
13648
|
})
|
|
@@ -13560,10 +13688,12 @@ async function readCommit({
|
|
|
13560
13688
|
assertParameter('gitdir', gitdir);
|
|
13561
13689
|
assertParameter('oid', oid);
|
|
13562
13690
|
|
|
13691
|
+
const fsp = new FileSystem(fs);
|
|
13692
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
13563
13693
|
return await _readCommit({
|
|
13564
|
-
fs:
|
|
13694
|
+
fs: fsp,
|
|
13565
13695
|
cache,
|
|
13566
|
-
gitdir,
|
|
13696
|
+
gitdir: updatedGitdir,
|
|
13567
13697
|
oid,
|
|
13568
13698
|
})
|
|
13569
13699
|
} catch (err) {
|
|
@@ -13636,10 +13766,12 @@ async function readNote({
|
|
|
13636
13766
|
assertParameter('ref', ref);
|
|
13637
13767
|
assertParameter('oid', oid);
|
|
13638
13768
|
|
|
13769
|
+
const fsp = new FileSystem(fs);
|
|
13770
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
13639
13771
|
return await _readNote({
|
|
13640
|
-
fs:
|
|
13772
|
+
fs: fsp,
|
|
13641
13773
|
cache,
|
|
13642
|
-
gitdir,
|
|
13774
|
+
gitdir: updatedGitdir,
|
|
13643
13775
|
ref,
|
|
13644
13776
|
oid,
|
|
13645
13777
|
})
|
|
@@ -13855,11 +13987,12 @@ async function readObject({
|
|
|
13855
13987
|
assertParameter('oid', oid);
|
|
13856
13988
|
|
|
13857
13989
|
const fs = new FileSystem(_fs);
|
|
13990
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
13858
13991
|
if (filepath !== undefined) {
|
|
13859
13992
|
oid = await resolveFilepath({
|
|
13860
13993
|
fs,
|
|
13861
13994
|
cache,
|
|
13862
|
-
gitdir,
|
|
13995
|
+
gitdir: updatedGitdir,
|
|
13863
13996
|
oid,
|
|
13864
13997
|
filepath,
|
|
13865
13998
|
});
|
|
@@ -13869,7 +14002,7 @@ async function readObject({
|
|
|
13869
14002
|
const result = await _readObject({
|
|
13870
14003
|
fs,
|
|
13871
14004
|
cache,
|
|
13872
|
-
gitdir,
|
|
14005
|
+
gitdir: updatedGitdir,
|
|
13873
14006
|
oid,
|
|
13874
14007
|
format: _format,
|
|
13875
14008
|
});
|
|
@@ -13988,10 +14121,12 @@ async function readTag({
|
|
|
13988
14121
|
assertParameter('gitdir', gitdir);
|
|
13989
14122
|
assertParameter('oid', oid);
|
|
13990
14123
|
|
|
14124
|
+
const fsp = new FileSystem(fs);
|
|
14125
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
13991
14126
|
return await _readTag({
|
|
13992
|
-
fs:
|
|
14127
|
+
fs: fsp,
|
|
13993
14128
|
cache,
|
|
13994
|
-
gitdir,
|
|
14129
|
+
gitdir: updatedGitdir,
|
|
13995
14130
|
oid,
|
|
13996
14131
|
})
|
|
13997
14132
|
} catch (err) {
|
|
@@ -14039,10 +14174,12 @@ async function readTree({
|
|
|
14039
14174
|
assertParameter('gitdir', gitdir);
|
|
14040
14175
|
assertParameter('oid', oid);
|
|
14041
14176
|
|
|
14177
|
+
const fsp = new FileSystem(fs);
|
|
14178
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
14042
14179
|
return await _readTree({
|
|
14043
|
-
fs:
|
|
14180
|
+
fs: fsp,
|
|
14044
14181
|
cache,
|
|
14045
|
-
gitdir,
|
|
14182
|
+
gitdir: updatedGitdir,
|
|
14046
14183
|
oid,
|
|
14047
14184
|
filepath,
|
|
14048
14185
|
})
|
|
@@ -14085,8 +14222,10 @@ async function remove({
|
|
|
14085
14222
|
assertParameter('gitdir', gitdir);
|
|
14086
14223
|
assertParameter('filepath', filepath);
|
|
14087
14224
|
|
|
14225
|
+
const fsp = new FileSystem(_fs);
|
|
14226
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
14088
14227
|
await GitIndexManager.acquire(
|
|
14089
|
-
{ fs:
|
|
14228
|
+
{ fs: fsp, gitdir: updatedGitdir, cache },
|
|
14090
14229
|
async function (index) {
|
|
14091
14230
|
index.delete({ filepath });
|
|
14092
14231
|
}
|
|
@@ -14227,13 +14366,18 @@ async function removeNote({
|
|
|
14227
14366
|
assertParameter('oid', oid);
|
|
14228
14367
|
|
|
14229
14368
|
const fs = new FileSystem(_fs);
|
|
14369
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
14230
14370
|
|
|
14231
|
-
const author = await normalizeAuthorObject({
|
|
14371
|
+
const author = await normalizeAuthorObject({
|
|
14372
|
+
fs,
|
|
14373
|
+
gitdir: updatedGitdir,
|
|
14374
|
+
author: _author,
|
|
14375
|
+
});
|
|
14232
14376
|
if (!author) throw new MissingNameError('author')
|
|
14233
14377
|
|
|
14234
14378
|
const committer = await normalizeCommitterObject({
|
|
14235
14379
|
fs,
|
|
14236
|
-
gitdir,
|
|
14380
|
+
gitdir: updatedGitdir,
|
|
14237
14381
|
author,
|
|
14238
14382
|
committer: _committer,
|
|
14239
14383
|
});
|
|
@@ -14243,7 +14387,7 @@ async function removeNote({
|
|
|
14243
14387
|
fs,
|
|
14244
14388
|
cache,
|
|
14245
14389
|
onSign,
|
|
14246
|
-
gitdir,
|
|
14390
|
+
gitdir: updatedGitdir,
|
|
14247
14391
|
ref,
|
|
14248
14392
|
oid,
|
|
14249
14393
|
author,
|
|
@@ -14355,9 +14499,11 @@ async function renameBranch({
|
|
|
14355
14499
|
assertParameter('gitdir', gitdir);
|
|
14356
14500
|
assertParameter('ref', ref);
|
|
14357
14501
|
assertParameter('oldref', oldref);
|
|
14502
|
+
const fsp = new FileSystem(fs);
|
|
14503
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
14358
14504
|
return await _renameBranch({
|
|
14359
|
-
fs:
|
|
14360
|
-
gitdir,
|
|
14505
|
+
fs: fsp,
|
|
14506
|
+
gitdir: updatedGitdir,
|
|
14361
14507
|
ref,
|
|
14362
14508
|
oldref,
|
|
14363
14509
|
checkout,
|
|
@@ -14408,13 +14554,18 @@ async function resetIndex({
|
|
|
14408
14554
|
assertParameter('filepath', filepath);
|
|
14409
14555
|
|
|
14410
14556
|
const fs = new FileSystem(_fs);
|
|
14557
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
14411
14558
|
|
|
14412
14559
|
let oid;
|
|
14413
14560
|
let workdirOid;
|
|
14414
14561
|
|
|
14415
14562
|
try {
|
|
14416
14563
|
// Resolve commit
|
|
14417
|
-
oid = await GitRefManager.resolve({
|
|
14564
|
+
oid = await GitRefManager.resolve({
|
|
14565
|
+
fs,
|
|
14566
|
+
gitdir: updatedGitdir,
|
|
14567
|
+
ref: ref || 'HEAD',
|
|
14568
|
+
});
|
|
14418
14569
|
} catch (e) {
|
|
14419
14570
|
if (ref) {
|
|
14420
14571
|
// Only throw the error if a ref is explicitly provided
|
|
@@ -14430,7 +14581,7 @@ async function resetIndex({
|
|
|
14430
14581
|
oid = await resolveFilepath({
|
|
14431
14582
|
fs,
|
|
14432
14583
|
cache,
|
|
14433
|
-
gitdir,
|
|
14584
|
+
gitdir: updatedGitdir,
|
|
14434
14585
|
oid,
|
|
14435
14586
|
filepath,
|
|
14436
14587
|
});
|
|
@@ -14456,7 +14607,7 @@ async function resetIndex({
|
|
|
14456
14607
|
if (object) {
|
|
14457
14608
|
// ... and has the same hash as the desired state...
|
|
14458
14609
|
workdirOid = await hashObject$1({
|
|
14459
|
-
gitdir,
|
|
14610
|
+
gitdir: updatedGitdir,
|
|
14460
14611
|
type: 'blob',
|
|
14461
14612
|
object,
|
|
14462
14613
|
});
|
|
@@ -14466,7 +14617,7 @@ async function resetIndex({
|
|
|
14466
14617
|
}
|
|
14467
14618
|
}
|
|
14468
14619
|
await GitIndexManager.acquire(
|
|
14469
|
-
{ fs, gitdir, cache },
|
|
14620
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
14470
14621
|
async function (index) {
|
|
14471
14622
|
index.delete({ filepath });
|
|
14472
14623
|
if (oid) {
|
|
@@ -14512,10 +14663,12 @@ async function resolveRef({
|
|
|
14512
14663
|
assertParameter('fs', fs);
|
|
14513
14664
|
assertParameter('gitdir', gitdir);
|
|
14514
14665
|
assertParameter('ref', ref);
|
|
14666
|
+
const fsp = new FileSystem(fs);
|
|
14667
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
14515
14668
|
|
|
14516
14669
|
const oid = await GitRefManager.resolve({
|
|
14517
|
-
fs:
|
|
14518
|
-
gitdir,
|
|
14670
|
+
fs: fsp,
|
|
14671
|
+
gitdir: updatedGitdir,
|
|
14519
14672
|
ref,
|
|
14520
14673
|
depth,
|
|
14521
14674
|
});
|
|
@@ -14585,13 +14738,14 @@ async function setConfig({
|
|
|
14585
14738
|
// assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete
|
|
14586
14739
|
|
|
14587
14740
|
const fs = new FileSystem(_fs);
|
|
14588
|
-
const
|
|
14741
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
14742
|
+
const config = await GitConfigManager.get({ fs, gitdir: updatedGitdir });
|
|
14589
14743
|
if (append) {
|
|
14590
14744
|
await config.append(path, value);
|
|
14591
14745
|
} else {
|
|
14592
14746
|
await config.set(path, value);
|
|
14593
14747
|
}
|
|
14594
|
-
await GitConfigManager.save({ fs, gitdir, config });
|
|
14748
|
+
await GitConfigManager.save({ fs, gitdir: updatedGitdir, config });
|
|
14595
14749
|
} catch (err) {
|
|
14596
14750
|
err.caller = 'git.setConfig';
|
|
14597
14751
|
throw err
|
|
@@ -15460,9 +15614,10 @@ async function stash({
|
|
|
15460
15614
|
|
|
15461
15615
|
try {
|
|
15462
15616
|
const _fs = new FileSystem(fs);
|
|
15617
|
+
const updatedGitdir = await discoverGitdir({ fsp: _fs, dotgit: gitdir });
|
|
15463
15618
|
const folders = ['refs', 'logs', 'logs/refs'];
|
|
15464
15619
|
folders
|
|
15465
|
-
.map(f => join(
|
|
15620
|
+
.map(f => join(updatedGitdir, f))
|
|
15466
15621
|
.forEach(async folder => {
|
|
15467
15622
|
if (!(await _fs.exists(folder))) {
|
|
15468
15623
|
await _fs.mkdir(folder);
|
|
@@ -15477,7 +15632,13 @@ async function stash({
|
|
|
15477
15632
|
'number that is in range of [0, num of stash pushed]'
|
|
15478
15633
|
)
|
|
15479
15634
|
}
|
|
15480
|
-
return await opFunc({
|
|
15635
|
+
return await opFunc({
|
|
15636
|
+
fs: _fs,
|
|
15637
|
+
dir,
|
|
15638
|
+
gitdir: updatedGitdir,
|
|
15639
|
+
message,
|
|
15640
|
+
refIdx,
|
|
15641
|
+
})
|
|
15481
15642
|
}
|
|
15482
15643
|
throw new Error(`To be implemented: ${op}`)
|
|
15483
15644
|
} catch (err) {
|
|
@@ -15536,25 +15697,26 @@ async function status({
|
|
|
15536
15697
|
assertParameter('filepath', filepath);
|
|
15537
15698
|
|
|
15538
15699
|
const fs = new FileSystem(_fs);
|
|
15700
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
15539
15701
|
const ignored = await GitIgnoreManager.isIgnored({
|
|
15540
15702
|
fs,
|
|
15541
|
-
gitdir,
|
|
15703
|
+
gitdir: updatedGitdir,
|
|
15542
15704
|
dir,
|
|
15543
15705
|
filepath,
|
|
15544
15706
|
});
|
|
15545
15707
|
if (ignored) {
|
|
15546
15708
|
return 'ignored'
|
|
15547
15709
|
}
|
|
15548
|
-
const headTree = await getHeadTree({ fs, cache, gitdir });
|
|
15710
|
+
const headTree = await getHeadTree({ fs, cache, gitdir: updatedGitdir });
|
|
15549
15711
|
const treeOid = await getOidAtPath({
|
|
15550
15712
|
fs,
|
|
15551
15713
|
cache,
|
|
15552
|
-
gitdir,
|
|
15714
|
+
gitdir: updatedGitdir,
|
|
15553
15715
|
tree: headTree,
|
|
15554
15716
|
path: filepath,
|
|
15555
15717
|
});
|
|
15556
15718
|
const indexEntry = await GitIndexManager.acquire(
|
|
15557
|
-
{ fs, gitdir, cache },
|
|
15719
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
15558
15720
|
async function (index) {
|
|
15559
15721
|
for (const entry of index) {
|
|
15560
15722
|
if (entry.path === filepath) return entry
|
|
@@ -15574,7 +15736,7 @@ async function status({
|
|
|
15574
15736
|
} else {
|
|
15575
15737
|
const object = await fs.read(join(dir, filepath));
|
|
15576
15738
|
const workdirOid = await hashObject$1({
|
|
15577
|
-
gitdir,
|
|
15739
|
+
gitdir: updatedGitdir,
|
|
15578
15740
|
type: 'blob',
|
|
15579
15741
|
object,
|
|
15580
15742
|
});
|
|
@@ -15586,7 +15748,7 @@ async function status({
|
|
|
15586
15748
|
if (stats.size !== -1) {
|
|
15587
15749
|
// We don't await this so we can return faster for one-off cases.
|
|
15588
15750
|
GitIndexManager.acquire(
|
|
15589
|
-
{ fs, gitdir, cache },
|
|
15751
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
15590
15752
|
async function (index) {
|
|
15591
15753
|
index.insert({ filepath, stats, oid: workdirOid });
|
|
15592
15754
|
}
|
|
@@ -15646,7 +15808,7 @@ async function status({
|
|
|
15646
15808
|
}
|
|
15647
15809
|
}
|
|
15648
15810
|
|
|
15649
|
-
async function getOidAtPath({ fs, cache, gitdir, tree, path }) {
|
|
15811
|
+
async function getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path }) {
|
|
15650
15812
|
if (typeof path === 'string') path = path.split('/');
|
|
15651
15813
|
const dirname = path.shift();
|
|
15652
15814
|
for (const entry of tree) {
|
|
@@ -15657,12 +15819,12 @@ async function getOidAtPath({ fs, cache, gitdir, tree, path }) {
|
|
|
15657
15819
|
const { type, object } = await _readObject({
|
|
15658
15820
|
fs,
|
|
15659
15821
|
cache,
|
|
15660
|
-
gitdir,
|
|
15822
|
+
gitdir: updatedGitdir,
|
|
15661
15823
|
oid: entry.oid,
|
|
15662
15824
|
});
|
|
15663
15825
|
if (type === 'tree') {
|
|
15664
15826
|
const tree = GitTree.from(object);
|
|
15665
|
-
return getOidAtPath({ fs, cache, gitdir, tree, path })
|
|
15827
|
+
return getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path })
|
|
15666
15828
|
}
|
|
15667
15829
|
if (type === 'blob') {
|
|
15668
15830
|
throw new ObjectTypeError(entry.oid, type, 'blob', path.join('/'))
|
|
@@ -15672,18 +15834,22 @@ async function getOidAtPath({ fs, cache, gitdir, tree, path }) {
|
|
|
15672
15834
|
return null
|
|
15673
15835
|
}
|
|
15674
15836
|
|
|
15675
|
-
async function getHeadTree({ fs, cache, gitdir }) {
|
|
15837
|
+
async function getHeadTree({ fs, cache, gitdir: updatedGitdir }) {
|
|
15676
15838
|
// Get the tree from the HEAD commit.
|
|
15677
15839
|
let oid;
|
|
15678
15840
|
try {
|
|
15679
|
-
oid = await GitRefManager.resolve({
|
|
15841
|
+
oid = await GitRefManager.resolve({
|
|
15842
|
+
fs,
|
|
15843
|
+
gitdir: updatedGitdir,
|
|
15844
|
+
ref: 'HEAD',
|
|
15845
|
+
});
|
|
15680
15846
|
} catch (e) {
|
|
15681
15847
|
// Handle fresh branches with no commits
|
|
15682
15848
|
if (e instanceof NotFoundError) {
|
|
15683
15849
|
return []
|
|
15684
15850
|
}
|
|
15685
15851
|
}
|
|
15686
|
-
const { tree } = await _readTree({ fs, cache, gitdir, oid });
|
|
15852
|
+
const { tree } = await _readTree({ fs, cache, gitdir: updatedGitdir, oid });
|
|
15687
15853
|
return tree
|
|
15688
15854
|
}
|
|
15689
15855
|
|
|
@@ -15848,11 +16014,12 @@ async function statusMatrix({
|
|
|
15848
16014
|
assertParameter('ref', ref);
|
|
15849
16015
|
|
|
15850
16016
|
const fs = new FileSystem(_fs);
|
|
16017
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
15851
16018
|
return await _walk({
|
|
15852
16019
|
fs,
|
|
15853
16020
|
cache,
|
|
15854
16021
|
dir,
|
|
15855
|
-
gitdir,
|
|
16022
|
+
gitdir: updatedGitdir,
|
|
15856
16023
|
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
15857
16024
|
map: async function (filepath, [head, workdir, stage]) {
|
|
15858
16025
|
// Ignore ignored files, but only if they are not already tracked.
|
|
@@ -15964,17 +16131,21 @@ async function tag({
|
|
|
15964
16131
|
ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`;
|
|
15965
16132
|
|
|
15966
16133
|
// Resolve passed object
|
|
16134
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
15967
16135
|
const value = await GitRefManager.resolve({
|
|
15968
16136
|
fs,
|
|
15969
|
-
gitdir,
|
|
16137
|
+
gitdir: updatedGitdir,
|
|
15970
16138
|
ref: object || 'HEAD',
|
|
15971
16139
|
});
|
|
15972
16140
|
|
|
15973
|
-
if (
|
|
16141
|
+
if (
|
|
16142
|
+
!force &&
|
|
16143
|
+
(await GitRefManager.exists({ fs, gitdir: updatedGitdir, ref }))
|
|
16144
|
+
) {
|
|
15974
16145
|
throw new AlreadyExistsError('tag', ref)
|
|
15975
16146
|
}
|
|
15976
16147
|
|
|
15977
|
-
await GitRefManager.writeRef({ fs, gitdir, ref, value });
|
|
16148
|
+
await GitRefManager.writeRef({ fs, gitdir: updatedGitdir, ref, value });
|
|
15978
16149
|
} catch (err) {
|
|
15979
16150
|
err.caller = 'git.tag';
|
|
15980
16151
|
throw err
|
|
@@ -16042,10 +16213,11 @@ async function updateIndex$1({
|
|
|
16042
16213
|
assertParameter('filepath', filepath);
|
|
16043
16214
|
|
|
16044
16215
|
const fs = new FileSystem(_fs);
|
|
16216
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
16045
16217
|
|
|
16046
16218
|
if (remove) {
|
|
16047
16219
|
return await GitIndexManager.acquire(
|
|
16048
|
-
{ fs, gitdir, cache },
|
|
16220
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
16049
16221
|
async function (index) {
|
|
16050
16222
|
if (!force) {
|
|
16051
16223
|
// Check if the file is still present in the working directory
|
|
@@ -16090,7 +16262,7 @@ async function updateIndex$1({
|
|
|
16090
16262
|
}
|
|
16091
16263
|
|
|
16092
16264
|
return await GitIndexManager.acquire(
|
|
16093
|
-
{ fs, gitdir, cache },
|
|
16265
|
+
{ fs, gitdir: updatedGitdir, cache },
|
|
16094
16266
|
async function (index) {
|
|
16095
16267
|
if (!add && !index.has({ filepath })) {
|
|
16096
16268
|
// If the index does not contain the filepath yet and `add` is not set, we should throw
|
|
@@ -16110,7 +16282,7 @@ async function updateIndex$1({
|
|
|
16110
16282
|
|
|
16111
16283
|
oid = await _writeObject({
|
|
16112
16284
|
fs,
|
|
16113
|
-
gitdir,
|
|
16285
|
+
gitdir: updatedGitdir,
|
|
16114
16286
|
type: 'blob',
|
|
16115
16287
|
format: 'content',
|
|
16116
16288
|
object,
|
|
@@ -16429,11 +16601,13 @@ async function walk({
|
|
|
16429
16601
|
assertParameter('gitdir', gitdir);
|
|
16430
16602
|
assertParameter('trees', trees);
|
|
16431
16603
|
|
|
16604
|
+
const fsp = new FileSystem(fs);
|
|
16605
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
16432
16606
|
return await _walk({
|
|
16433
|
-
fs:
|
|
16607
|
+
fs: fsp,
|
|
16434
16608
|
cache,
|
|
16435
16609
|
dir,
|
|
16436
|
-
gitdir,
|
|
16610
|
+
gitdir: updatedGitdir,
|
|
16437
16611
|
trees,
|
|
16438
16612
|
map,
|
|
16439
16613
|
reduce,
|
|
@@ -16475,9 +16649,11 @@ async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {
|
|
|
16475
16649
|
assertParameter('gitdir', gitdir);
|
|
16476
16650
|
assertParameter('blob', blob);
|
|
16477
16651
|
|
|
16652
|
+
const fsp = new FileSystem(fs);
|
|
16653
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
16478
16654
|
return await _writeObject({
|
|
16479
|
-
fs:
|
|
16480
|
-
gitdir,
|
|
16655
|
+
fs: fsp,
|
|
16656
|
+
gitdir: updatedGitdir,
|
|
16481
16657
|
type: 'blob',
|
|
16482
16658
|
object: blob,
|
|
16483
16659
|
format: 'content',
|
|
@@ -16514,9 +16690,11 @@ async function writeCommit({
|
|
|
16514
16690
|
assertParameter('gitdir', gitdir);
|
|
16515
16691
|
assertParameter('commit', commit);
|
|
16516
16692
|
|
|
16693
|
+
const fsp = new FileSystem(fs);
|
|
16694
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
16517
16695
|
return await _writeCommit({
|
|
16518
|
-
fs:
|
|
16519
|
-
gitdir,
|
|
16696
|
+
fs: fsp,
|
|
16697
|
+
gitdir: updatedGitdir,
|
|
16520
16698
|
commit,
|
|
16521
16699
|
})
|
|
16522
16700
|
} catch (err) {
|
|
@@ -16604,6 +16782,7 @@ async function writeObject({
|
|
|
16604
16782
|
}) {
|
|
16605
16783
|
try {
|
|
16606
16784
|
const fs = new FileSystem(_fs);
|
|
16785
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
16607
16786
|
// Convert object to buffer
|
|
16608
16787
|
if (format === 'parsed') {
|
|
16609
16788
|
switch (type) {
|
|
@@ -16627,7 +16806,7 @@ async function writeObject({
|
|
|
16627
16806
|
}
|
|
16628
16807
|
oid = await _writeObject({
|
|
16629
16808
|
fs,
|
|
16630
|
-
gitdir,
|
|
16809
|
+
gitdir: updatedGitdir,
|
|
16631
16810
|
type,
|
|
16632
16811
|
object,
|
|
16633
16812
|
oid,
|
|
@@ -16695,26 +16874,30 @@ async function writeRef({
|
|
|
16695
16874
|
throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
|
|
16696
16875
|
}
|
|
16697
16876
|
|
|
16698
|
-
|
|
16877
|
+
const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir });
|
|
16878
|
+
if (
|
|
16879
|
+
!force &&
|
|
16880
|
+
(await GitRefManager.exists({ fs, gitdir: updatedGitdir, ref }))
|
|
16881
|
+
) {
|
|
16699
16882
|
throw new AlreadyExistsError('ref', ref)
|
|
16700
16883
|
}
|
|
16701
16884
|
|
|
16702
16885
|
if (symbolic) {
|
|
16703
16886
|
await GitRefManager.writeSymbolicRef({
|
|
16704
16887
|
fs,
|
|
16705
|
-
gitdir,
|
|
16888
|
+
gitdir: updatedGitdir,
|
|
16706
16889
|
ref,
|
|
16707
16890
|
value,
|
|
16708
16891
|
});
|
|
16709
16892
|
} else {
|
|
16710
16893
|
value = await GitRefManager.resolve({
|
|
16711
16894
|
fs,
|
|
16712
|
-
gitdir,
|
|
16895
|
+
gitdir: updatedGitdir,
|
|
16713
16896
|
ref: value,
|
|
16714
16897
|
});
|
|
16715
16898
|
await GitRefManager.writeRef({
|
|
16716
16899
|
fs,
|
|
16717
|
-
gitdir,
|
|
16900
|
+
gitdir: updatedGitdir,
|
|
16718
16901
|
ref,
|
|
16719
16902
|
value,
|
|
16720
16903
|
});
|
|
@@ -16793,9 +16976,11 @@ async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {
|
|
|
16793
16976
|
assertParameter('gitdir', gitdir);
|
|
16794
16977
|
assertParameter('tag', tag);
|
|
16795
16978
|
|
|
16979
|
+
const fsp = new FileSystem(fs);
|
|
16980
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
16796
16981
|
return await _writeTag({
|
|
16797
|
-
fs:
|
|
16798
|
-
gitdir,
|
|
16982
|
+
fs: fsp,
|
|
16983
|
+
gitdir: updatedGitdir,
|
|
16799
16984
|
tag,
|
|
16800
16985
|
})
|
|
16801
16986
|
} catch (err) {
|
|
@@ -16826,9 +17011,11 @@ async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {
|
|
|
16826
17011
|
assertParameter('gitdir', gitdir);
|
|
16827
17012
|
assertParameter('tree', tree);
|
|
16828
17013
|
|
|
17014
|
+
const fsp = new FileSystem(fs);
|
|
17015
|
+
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
16829
17016
|
return await _writeTree({
|
|
16830
|
-
fs:
|
|
16831
|
-
gitdir,
|
|
17017
|
+
fs: fsp,
|
|
17018
|
+
gitdir: updatedGitdir,
|
|
16832
17019
|
tree,
|
|
16833
17020
|
})
|
|
16834
17021
|
} catch (err) {
|