isomorphic-git 1.34.2 → 1.35.1
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 +13 -2
- package/http/web/index.cjs +1 -1
- package/http/web/index.js +1 -1
- package/http/web/index.umd.js +1 -1
- package/index.cjs +470 -340
- package/index.js +360 -230
- package/index.umd.min.js +2 -12
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +173 -80
- package/managers/index.js +152 -59
- package/managers/index.umd.min.js +2 -12
- package/managers/index.umd.min.js.LICENSE.txt +18 -0
- package/managers/index.umd.min.js.map +1 -1
- package/models/index.cjs +99 -4
- package/models/index.js +98 -3
- package/models/index.umd.min.js +2 -8
- package/models/index.umd.min.js.LICENSE.txt +5 -0
- package/models/index.umd.min.js.map +1 -1
- package/package.json +20 -45
- package/browser-tests.json +0 -10
- package/size_report.html +0 -64
package/index.cjs
CHANGED
|
@@ -6,13 +6,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var AsyncLock = _interopDefault(require('async-lock'));
|
|
8
8
|
var Hash = _interopDefault(require('sha.js/sha1.js'));
|
|
9
|
-
var pathBrowserify = require('path-browserify');
|
|
10
9
|
var crc32 = _interopDefault(require('crc-32'));
|
|
11
10
|
var pako = _interopDefault(require('pako'));
|
|
12
11
|
var pify = _interopDefault(require('pify'));
|
|
13
12
|
var ignore = _interopDefault(require('ignore'));
|
|
14
13
|
var cleanGitRef = _interopDefault(require('clean-git-ref'));
|
|
15
|
-
var validRef = _interopDefault(require('is-git-ref-name-valid'));
|
|
16
14
|
var diff3Merge = _interopDefault(require('diff3'));
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -850,7 +848,7 @@ class GitIndex {
|
|
|
850
848
|
gid: stats.gid,
|
|
851
849
|
size: stats.size,
|
|
852
850
|
path: filepath,
|
|
853
|
-
oid
|
|
851
|
+
oid,
|
|
854
852
|
flags: {
|
|
855
853
|
assumeValid: false,
|
|
856
854
|
extended: false,
|
|
@@ -1099,7 +1097,7 @@ type Node = {
|
|
|
1099
1097
|
|
|
1100
1098
|
function flatFileListToDirectoryStructure(files) {
|
|
1101
1099
|
const inodes = new Map();
|
|
1102
|
-
const mkdir = function(name) {
|
|
1100
|
+
const mkdir = function (name) {
|
|
1103
1101
|
if (!inodes.has(name)) {
|
|
1104
1102
|
const dir = {
|
|
1105
1103
|
type: 'tree',
|
|
@@ -1118,13 +1116,13 @@ function flatFileListToDirectoryStructure(files) {
|
|
|
1118
1116
|
return inodes.get(name)
|
|
1119
1117
|
};
|
|
1120
1118
|
|
|
1121
|
-
const mkfile = function(name, metadata) {
|
|
1119
|
+
const mkfile = function (name, metadata) {
|
|
1122
1120
|
if (!inodes.has(name)) {
|
|
1123
1121
|
const file = {
|
|
1124
1122
|
type: 'blob',
|
|
1125
1123
|
fullpath: name,
|
|
1126
1124
|
basename: basename(name),
|
|
1127
|
-
metadata
|
|
1125
|
+
metadata,
|
|
1128
1126
|
// This recursively generates any missing parent folders.
|
|
1129
1127
|
parent: mkdir(dirname(name)),
|
|
1130
1128
|
children: [],
|
|
@@ -1162,7 +1160,7 @@ class GitWalkerIndex {
|
|
|
1162
1160
|
constructor({ fs, gitdir, cache }) {
|
|
1163
1161
|
this.treePromise = GitIndexManager.acquire(
|
|
1164
1162
|
{ fs, gitdir, cache },
|
|
1165
|
-
async function(index) {
|
|
1163
|
+
async function (index) {
|
|
1166
1164
|
return flatFileListToDirectoryStructure(index.entries)
|
|
1167
1165
|
}
|
|
1168
1166
|
);
|
|
@@ -1276,7 +1274,7 @@ const GitWalkSymbol = Symbol('GitWalkSymbol');
|
|
|
1276
1274
|
function STAGE() {
|
|
1277
1275
|
const o = Object.create(null);
|
|
1278
1276
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
1279
|
-
value: function({ fs, gitdir, cache }) {
|
|
1277
|
+
value: function ({ fs, gitdir, cache }) {
|
|
1280
1278
|
return new GitWalkerIndex({ fs, gitdir, cache })
|
|
1281
1279
|
},
|
|
1282
1280
|
});
|
|
@@ -1406,13 +1404,8 @@ class GitRefSpec {
|
|
|
1406
1404
|
}
|
|
1407
1405
|
|
|
1408
1406
|
static from(refspec) {
|
|
1409
|
-
const [
|
|
1410
|
-
|
|
1411
|
-
remotePath,
|
|
1412
|
-
remoteGlobMatch,
|
|
1413
|
-
localPath,
|
|
1414
|
-
localGlobMatch,
|
|
1415
|
-
] = refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1);
|
|
1407
|
+
const [forceMatch, remotePath, remoteGlobMatch, localPath, localGlobMatch] =
|
|
1408
|
+
refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1);
|
|
1416
1409
|
const force = forceMatch === '+';
|
|
1417
1410
|
const remoteIsGlob = remoteGlobMatch === '*';
|
|
1418
1411
|
const localIsGlob = localGlobMatch === '*';
|
|
@@ -1513,6 +1506,104 @@ function compareRefNames(a, b) {
|
|
|
1513
1506
|
return tmp
|
|
1514
1507
|
}
|
|
1515
1508
|
|
|
1509
|
+
/*!
|
|
1510
|
+
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
|
1511
|
+
* SPDX-License-Identifier: LGPL-3.0-or-later
|
|
1512
|
+
* Copyright (c) James Prevett and other ZenFS contributors.
|
|
1513
|
+
*/
|
|
1514
|
+
|
|
1515
|
+
function normalizeString(path, aar) {
|
|
1516
|
+
let res = '';
|
|
1517
|
+
let lastSegmentLength = 0;
|
|
1518
|
+
let lastSlash = -1;
|
|
1519
|
+
let dots = 0;
|
|
1520
|
+
let char = '\x00';
|
|
1521
|
+
for (let i = 0; i <= path.length; ++i) {
|
|
1522
|
+
if (i < path.length) char = path[i];
|
|
1523
|
+
else if (char === '/') break
|
|
1524
|
+
else char = '/';
|
|
1525
|
+
|
|
1526
|
+
if (char === '/') {
|
|
1527
|
+
if (lastSlash === i - 1 || dots === 1) {
|
|
1528
|
+
// NOOP
|
|
1529
|
+
} else if (dots === 2) {
|
|
1530
|
+
if (
|
|
1531
|
+
res.length < 2 ||
|
|
1532
|
+
lastSegmentLength !== 2 ||
|
|
1533
|
+
res.at(-1) !== '.' ||
|
|
1534
|
+
res.at(-2) !== '.'
|
|
1535
|
+
) {
|
|
1536
|
+
if (res.length > 2) {
|
|
1537
|
+
const lastSlashIndex = res.lastIndexOf('/');
|
|
1538
|
+
if (lastSlashIndex === -1) {
|
|
1539
|
+
res = '';
|
|
1540
|
+
lastSegmentLength = 0;
|
|
1541
|
+
} else {
|
|
1542
|
+
res = res.slice(0, lastSlashIndex);
|
|
1543
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
1544
|
+
}
|
|
1545
|
+
lastSlash = i;
|
|
1546
|
+
dots = 0;
|
|
1547
|
+
continue
|
|
1548
|
+
} else if (res.length !== 0) {
|
|
1549
|
+
res = '';
|
|
1550
|
+
lastSegmentLength = 0;
|
|
1551
|
+
lastSlash = i;
|
|
1552
|
+
dots = 0;
|
|
1553
|
+
continue
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
if (aar) {
|
|
1557
|
+
res += res.length > 0 ? '/..' : '..';
|
|
1558
|
+
lastSegmentLength = 2;
|
|
1559
|
+
}
|
|
1560
|
+
} else {
|
|
1561
|
+
if (res.length > 0) res += '/' + path.slice(lastSlash + 1, i);
|
|
1562
|
+
else res = path.slice(lastSlash + 1, i);
|
|
1563
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
1564
|
+
}
|
|
1565
|
+
lastSlash = i;
|
|
1566
|
+
dots = 0;
|
|
1567
|
+
} else if (char === '.' && dots !== -1) {
|
|
1568
|
+
++dots;
|
|
1569
|
+
} else {
|
|
1570
|
+
dots = -1;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
return res
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
function normalize(path) {
|
|
1577
|
+
if (!path.length) return '.'
|
|
1578
|
+
|
|
1579
|
+
const isAbsolute = path[0] === '/';
|
|
1580
|
+
const trailingSeparator = path.at(-1) === '/';
|
|
1581
|
+
|
|
1582
|
+
path = normalizeString(path, !isAbsolute);
|
|
1583
|
+
|
|
1584
|
+
if (!path.length) {
|
|
1585
|
+
if (isAbsolute) return '/'
|
|
1586
|
+
return trailingSeparator ? './' : '.'
|
|
1587
|
+
}
|
|
1588
|
+
if (trailingSeparator) path += '/';
|
|
1589
|
+
|
|
1590
|
+
return isAbsolute ? `/${path}` : path
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function join(...args) {
|
|
1594
|
+
if (args.length === 0) return '.'
|
|
1595
|
+
let joined;
|
|
1596
|
+
for (let i = 0; i < args.length; ++i) {
|
|
1597
|
+
const arg = args[i];
|
|
1598
|
+
if (arg.length > 0) {
|
|
1599
|
+
if (joined === undefined) joined = arg;
|
|
1600
|
+
else joined += '/' + arg;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
if (joined === undefined) return '.'
|
|
1604
|
+
return normalize(joined)
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1516
1607
|
// This is straight from parse_unit_factor in config.c of canonical git
|
|
1517
1608
|
const num = val => {
|
|
1518
1609
|
if (typeof val === 'number') {
|
|
@@ -1992,7 +2083,7 @@ class GitRefManager {
|
|
|
1992
2083
|
// and .git/refs/remotes/origin/refs/merge-requests
|
|
1993
2084
|
for (const [key, value] of actualRefsToWrite) {
|
|
1994
2085
|
await acquireLock(key, async () =>
|
|
1995
|
-
fs.write(
|
|
2086
|
+
fs.write(join(gitdir, key), `${value.trim()}\n`, 'utf8')
|
|
1996
2087
|
);
|
|
1997
2088
|
}
|
|
1998
2089
|
return { pruned }
|
|
@@ -2015,7 +2106,7 @@ class GitRefManager {
|
|
|
2015
2106
|
throw new InvalidOidError(value)
|
|
2016
2107
|
}
|
|
2017
2108
|
await acquireLock(ref, async () =>
|
|
2018
|
-
fs.write(
|
|
2109
|
+
fs.write(join(gitdir, ref), `${value.trim()}\n`, 'utf8')
|
|
2019
2110
|
);
|
|
2020
2111
|
}
|
|
2021
2112
|
|
|
@@ -2031,7 +2122,7 @@ class GitRefManager {
|
|
|
2031
2122
|
*/
|
|
2032
2123
|
static async writeSymbolicRef({ fs, gitdir, ref, value }) {
|
|
2033
2124
|
await acquireLock(ref, async () =>
|
|
2034
|
-
fs.write(
|
|
2125
|
+
fs.write(join(gitdir, ref), 'ref: ' + `${value.trim()}\n`, 'utf8')
|
|
2035
2126
|
);
|
|
2036
2127
|
}
|
|
2037
2128
|
|
|
@@ -2059,7 +2150,7 @@ class GitRefManager {
|
|
|
2059
2150
|
*/
|
|
2060
2151
|
static async deleteRefs({ fs, gitdir, refs }) {
|
|
2061
2152
|
// Delete regular ref
|
|
2062
|
-
await Promise.all(refs.map(ref => fs.rm(
|
|
2153
|
+
await Promise.all(refs.map(ref => fs.rm(join(gitdir, ref))));
|
|
2063
2154
|
// Delete any packed ref
|
|
2064
2155
|
let text = await acquireLock('packed-refs', async () =>
|
|
2065
2156
|
fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })
|
|
@@ -3286,7 +3377,7 @@ async function readObjectPacked({
|
|
|
3286
3377
|
}) {
|
|
3287
3378
|
// Check to see if it's in a packfile.
|
|
3288
3379
|
// Iterate through all the .idx files
|
|
3289
|
-
let list = await fs.readdir(
|
|
3380
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
3290
3381
|
list = list.filter(x => x.endsWith('.idx'));
|
|
3291
3382
|
for (const filename of list) {
|
|
3292
3383
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -3858,8 +3949,8 @@ function parseAuthor(author) {
|
|
|
3858
3949
|
/^(.*) <(.*)> (.*) (.*)$/
|
|
3859
3950
|
);
|
|
3860
3951
|
return {
|
|
3861
|
-
name
|
|
3862
|
-
email
|
|
3952
|
+
name,
|
|
3953
|
+
email,
|
|
3863
3954
|
timestamp: Number(timestamp),
|
|
3864
3955
|
timezoneOffset: parseTimezoneOffset(offset),
|
|
3865
3956
|
}
|
|
@@ -4257,9 +4348,9 @@ class GitWalkerRepo {
|
|
|
4257
4348
|
const tree = GitTree.from(object);
|
|
4258
4349
|
// cache all entries
|
|
4259
4350
|
for (const entry of tree) {
|
|
4260
|
-
map.set(
|
|
4351
|
+
map.set(join(filepath, entry.path), entry);
|
|
4261
4352
|
}
|
|
4262
|
-
return tree.entries().map(entry =>
|
|
4353
|
+
return tree.entries().map(entry => join(filepath, entry.path))
|
|
4263
4354
|
}
|
|
4264
4355
|
|
|
4265
4356
|
async type(entry) {
|
|
@@ -4318,7 +4409,7 @@ class GitWalkerRepo {
|
|
|
4318
4409
|
function TREE({ ref = 'HEAD' } = {}) {
|
|
4319
4410
|
const o = Object.create(null);
|
|
4320
4411
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
4321
|
-
value: function({ fs, gitdir, cache }) {
|
|
4412
|
+
value: function ({ fs, gitdir, cache }) {
|
|
4322
4413
|
return new GitWalkerRepo({ fs, gitdir, ref, cache })
|
|
4323
4414
|
},
|
|
4324
4415
|
});
|
|
@@ -4372,9 +4463,9 @@ class GitWalkerFs {
|
|
|
4372
4463
|
async readdir(entry) {
|
|
4373
4464
|
const filepath = entry._fullpath;
|
|
4374
4465
|
const { fs, dir } = this;
|
|
4375
|
-
const names = await fs.readdir(
|
|
4466
|
+
const names = await fs.readdir(join(dir, filepath));
|
|
4376
4467
|
if (names === null) return null
|
|
4377
|
-
return names.map(name =>
|
|
4468
|
+
return names.map(name => join(filepath, name))
|
|
4378
4469
|
}
|
|
4379
4470
|
|
|
4380
4471
|
async type(entry) {
|
|
@@ -4442,46 +4533,47 @@ class GitWalkerFs {
|
|
|
4442
4533
|
const { fs, gitdir, cache } = this;
|
|
4443
4534
|
let oid;
|
|
4444
4535
|
// See if we can use the SHA1 hash in the index.
|
|
4445
|
-
await GitIndexManager.acquire(
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4536
|
+
await GitIndexManager.acquire(
|
|
4537
|
+
{ fs, gitdir, cache },
|
|
4538
|
+
async function (index) {
|
|
4539
|
+
const stage = index.entriesMap.get(entry._fullpath);
|
|
4540
|
+
const stats = await entry.stat();
|
|
4541
|
+
const config = await self._getGitConfig(fs, gitdir);
|
|
4542
|
+
const filemode = await config.get('core.filemode');
|
|
4543
|
+
const trustino =
|
|
4544
|
+
typeof process !== 'undefined'
|
|
4545
|
+
? !(process.platform === 'win32')
|
|
4546
|
+
: true;
|
|
4547
|
+
if (!stage || compareStats(stats, stage, filemode, trustino)) {
|
|
4548
|
+
const content = await entry.content();
|
|
4549
|
+
if (content === undefined) {
|
|
4550
|
+
oid = undefined;
|
|
4551
|
+
} else {
|
|
4552
|
+
oid = await shasum(
|
|
4553
|
+
GitObject.wrap({ type: 'blob', object: content })
|
|
4554
|
+
);
|
|
4555
|
+
// Update the stats in the index so we will get a "cache hit" next time
|
|
4556
|
+
// 1) if we can (because the oid and mode are the same)
|
|
4557
|
+
// 2) and only if we need to (because other stats differ)
|
|
4558
|
+
if (
|
|
4559
|
+
stage &&
|
|
4560
|
+
oid === stage.oid &&
|
|
4561
|
+
(!filemode || stats.mode === stage.mode) &&
|
|
4562
|
+
compareStats(stats, stage, filemode, trustino)
|
|
4563
|
+
) {
|
|
4564
|
+
index.insert({
|
|
4565
|
+
filepath: entry._fullpath,
|
|
4566
|
+
stats,
|
|
4567
|
+
oid,
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4478
4570
|
}
|
|
4571
|
+
} else {
|
|
4572
|
+
// Use the index SHA1 rather than compute it
|
|
4573
|
+
oid = stage.oid;
|
|
4479
4574
|
}
|
|
4480
|
-
} else {
|
|
4481
|
-
// Use the index SHA1 rather than compute it
|
|
4482
|
-
oid = stage.oid;
|
|
4483
4575
|
}
|
|
4484
|
-
|
|
4576
|
+
);
|
|
4485
4577
|
entry._oid = oid;
|
|
4486
4578
|
}
|
|
4487
4579
|
return entry._oid
|
|
@@ -4504,7 +4596,7 @@ class GitWalkerFs {
|
|
|
4504
4596
|
function WORKDIR() {
|
|
4505
4597
|
const o = Object.create(null);
|
|
4506
4598
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
4507
|
-
value: function({ fs, dir, gitdir, cache }) {
|
|
4599
|
+
value: function ({ fs, dir, gitdir, cache }) {
|
|
4508
4600
|
return new GitWalkerFs({ fs, dir, gitdir, cache })
|
|
4509
4601
|
},
|
|
4510
4602
|
});
|
|
@@ -4649,7 +4741,7 @@ async function _walk({
|
|
|
4649
4741
|
const root = new Array(walkers.length).fill('.');
|
|
4650
4742
|
const range = arrayRange(0, walkers.length);
|
|
4651
4743
|
const unionWalkerFromReaddir = async entries => {
|
|
4652
|
-
range.
|
|
4744
|
+
range.forEach(i => {
|
|
4653
4745
|
const entry = entries[i];
|
|
4654
4746
|
entries[i] = entry && new walkers[i].ConstructEntry(entry);
|
|
4655
4747
|
});
|
|
@@ -4698,7 +4790,7 @@ async function rmRecursive(fs, filepath) {
|
|
|
4698
4790
|
} else if (entries.length) {
|
|
4699
4791
|
await Promise.all(
|
|
4700
4792
|
entries.map(entry => {
|
|
4701
|
-
const subpath =
|
|
4793
|
+
const subpath = join(filepath, entry);
|
|
4702
4794
|
return fs.lstat(subpath).then(stat => {
|
|
4703
4795
|
if (!stat) return
|
|
4704
4796
|
return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath)
|
|
@@ -4861,7 +4953,6 @@ class FileSystem {
|
|
|
4861
4953
|
async write(filepath, contents, options = {}) {
|
|
4862
4954
|
try {
|
|
4863
4955
|
await this._writeFile(filepath, contents, options);
|
|
4864
|
-
return
|
|
4865
4956
|
} catch (err) {
|
|
4866
4957
|
// Hmm. Let's try mkdirp and try again.
|
|
4867
4958
|
await this.mkdir(dirname(filepath));
|
|
@@ -4879,7 +4970,6 @@ class FileSystem {
|
|
|
4879
4970
|
async mkdir(filepath, _selfCall = false) {
|
|
4880
4971
|
try {
|
|
4881
4972
|
await this._mkdir(filepath);
|
|
4882
|
-
return
|
|
4883
4973
|
} catch (err) {
|
|
4884
4974
|
// If err is null then operation succeeded!
|
|
4885
4975
|
if (err === null) return
|
|
@@ -5085,7 +5175,7 @@ async function modified(entry, base) {
|
|
|
5085
5175
|
async function abortMerge({
|
|
5086
5176
|
fs: _fs,
|
|
5087
5177
|
dir,
|
|
5088
|
-
gitdir =
|
|
5178
|
+
gitdir = join(dir, '.git'),
|
|
5089
5179
|
commit = 'HEAD',
|
|
5090
5180
|
cache = {},
|
|
5091
5181
|
}) {
|
|
@@ -5098,9 +5188,12 @@ async function abortMerge({
|
|
|
5098
5188
|
const trees = [TREE({ ref: commit }), WORKDIR(), STAGE()];
|
|
5099
5189
|
let unmergedPaths = [];
|
|
5100
5190
|
|
|
5101
|
-
await GitIndexManager.acquire(
|
|
5102
|
-
|
|
5103
|
-
|
|
5191
|
+
await GitIndexManager.acquire(
|
|
5192
|
+
{ fs, gitdir, cache },
|
|
5193
|
+
async function (index) {
|
|
5194
|
+
unmergedPaths = index.unmergedPaths;
|
|
5195
|
+
}
|
|
5196
|
+
);
|
|
5104
5197
|
|
|
5105
5198
|
const results = await _walk({
|
|
5106
5199
|
fs,
|
|
@@ -5108,7 +5201,7 @@ async function abortMerge({
|
|
|
5108
5201
|
dir,
|
|
5109
5202
|
gitdir,
|
|
5110
5203
|
trees,
|
|
5111
|
-
map: async function(path, [head, workdir, index]) {
|
|
5204
|
+
map: async function (path, [head, workdir, index]) {
|
|
5112
5205
|
const staged = !(await modified(workdir, index));
|
|
5113
5206
|
const unmerged = unmergedPaths.includes(path);
|
|
5114
5207
|
const unmodified = !(await modified(index, head));
|
|
@@ -5130,31 +5223,36 @@ async function abortMerge({
|
|
|
5130
5223
|
},
|
|
5131
5224
|
});
|
|
5132
5225
|
|
|
5133
|
-
await GitIndexManager.acquire(
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5226
|
+
await GitIndexManager.acquire(
|
|
5227
|
+
{ fs, gitdir, cache },
|
|
5228
|
+
async function (index) {
|
|
5229
|
+
// Reset paths in index and worktree, this can't be done in _walk because the
|
|
5230
|
+
// STAGE walker acquires its own index lock.
|
|
5231
|
+
|
|
5232
|
+
for (const entry of results) {
|
|
5233
|
+
if (entry === false) continue
|
|
5234
|
+
|
|
5235
|
+
// entry is not false, so from here we can assume index = workdir
|
|
5236
|
+
if (!entry) {
|
|
5237
|
+
await fs.rmdir(`${dir}/${entry.path}`, { recursive: true });
|
|
5238
|
+
index.delete({ filepath: entry.path });
|
|
5239
|
+
continue
|
|
5240
|
+
}
|
|
5146
5241
|
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5242
|
+
if (entry.type === 'blob') {
|
|
5243
|
+
const content = new TextDecoder().decode(entry.content);
|
|
5244
|
+
await fs.write(`${dir}/${entry.path}`, content, {
|
|
5245
|
+
mode: entry.mode,
|
|
5246
|
+
});
|
|
5247
|
+
index.insert({
|
|
5248
|
+
filepath: entry.path,
|
|
5249
|
+
oid: entry.oid,
|
|
5250
|
+
stage: 0,
|
|
5251
|
+
});
|
|
5252
|
+
}
|
|
5155
5253
|
}
|
|
5156
5254
|
}
|
|
5157
|
-
|
|
5255
|
+
);
|
|
5158
5256
|
} catch (err) {
|
|
5159
5257
|
err.caller = 'git.abortMerge';
|
|
5160
5258
|
throw err
|
|
@@ -5174,21 +5272,21 @@ class GitIgnoreManager {
|
|
|
5174
5272
|
* @param {string} args.filepath - The path of the file to check.
|
|
5175
5273
|
* @returns {Promise<boolean>} - `true` if the file is ignored, `false` otherwise.
|
|
5176
5274
|
*/
|
|
5177
|
-
static async isIgnored({ fs, dir, gitdir =
|
|
5275
|
+
static async isIgnored({ fs, dir, gitdir = join(dir, '.git'), filepath }) {
|
|
5178
5276
|
// ALWAYS ignore ".git" folders.
|
|
5179
5277
|
if (basename(filepath) === '.git') return true
|
|
5180
5278
|
// '.' is not a valid gitignore entry, so '.' is never ignored
|
|
5181
5279
|
if (filepath === '.') return false
|
|
5182
5280
|
// Check and load exclusion rules from project exclude file (.git/info/exclude)
|
|
5183
5281
|
let excludes = '';
|
|
5184
|
-
const excludesFile =
|
|
5282
|
+
const excludesFile = join(gitdir, 'info', 'exclude');
|
|
5185
5283
|
if (await fs.exists(excludesFile)) {
|
|
5186
5284
|
excludes = await fs.read(excludesFile, 'utf8');
|
|
5187
5285
|
}
|
|
5188
5286
|
// Find all the .gitignore files that could affect this file
|
|
5189
5287
|
const pairs = [
|
|
5190
5288
|
{
|
|
5191
|
-
gitignore:
|
|
5289
|
+
gitignore: join(dir, '.gitignore'),
|
|
5192
5290
|
filepath,
|
|
5193
5291
|
},
|
|
5194
5292
|
];
|
|
@@ -5197,7 +5295,7 @@ class GitIgnoreManager {
|
|
|
5197
5295
|
const folder = pieces.slice(0, i).join('/');
|
|
5198
5296
|
const file = pieces.slice(i).join('/');
|
|
5199
5297
|
pairs.push({
|
|
5200
|
-
gitignore:
|
|
5298
|
+
gitignore: join(dir, folder, '.gitignore'),
|
|
5201
5299
|
filepath: file,
|
|
5202
5300
|
});
|
|
5203
5301
|
}
|
|
@@ -5326,7 +5424,7 @@ function posixifyPathBuffer(buffer) {
|
|
|
5326
5424
|
async function add({
|
|
5327
5425
|
fs: _fs,
|
|
5328
5426
|
dir,
|
|
5329
|
-
gitdir =
|
|
5427
|
+
gitdir = join(dir, '.git'),
|
|
5330
5428
|
filepath,
|
|
5331
5429
|
cache = {},
|
|
5332
5430
|
force = false,
|
|
@@ -5381,18 +5479,18 @@ async function addToIndex({
|
|
|
5381
5479
|
});
|
|
5382
5480
|
if (ignored) return
|
|
5383
5481
|
}
|
|
5384
|
-
const stats = await fs.lstat(
|
|
5482
|
+
const stats = await fs.lstat(join(dir, currentFilepath));
|
|
5385
5483
|
if (!stats) throw new NotFoundError(currentFilepath)
|
|
5386
5484
|
|
|
5387
5485
|
if (stats.isDirectory()) {
|
|
5388
|
-
const children = await fs.readdir(
|
|
5486
|
+
const children = await fs.readdir(join(dir, currentFilepath));
|
|
5389
5487
|
if (parallel) {
|
|
5390
5488
|
const promises = children.map(child =>
|
|
5391
5489
|
addToIndex({
|
|
5392
5490
|
dir,
|
|
5393
5491
|
gitdir,
|
|
5394
5492
|
fs,
|
|
5395
|
-
filepath: [
|
|
5493
|
+
filepath: [join(currentFilepath, child)],
|
|
5396
5494
|
index,
|
|
5397
5495
|
force,
|
|
5398
5496
|
parallel,
|
|
@@ -5406,7 +5504,7 @@ async function addToIndex({
|
|
|
5406
5504
|
dir,
|
|
5407
5505
|
gitdir,
|
|
5408
5506
|
fs,
|
|
5409
|
-
filepath: [
|
|
5507
|
+
filepath: [join(currentFilepath, child)],
|
|
5410
5508
|
index,
|
|
5411
5509
|
force,
|
|
5412
5510
|
parallel,
|
|
@@ -5416,8 +5514,8 @@ async function addToIndex({
|
|
|
5416
5514
|
}
|
|
5417
5515
|
} else {
|
|
5418
5516
|
const object = stats.isSymbolicLink()
|
|
5419
|
-
? await fs.readlink(
|
|
5420
|
-
: await fs.read(
|
|
5517
|
+
? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
|
|
5518
|
+
: await fs.read(join(dir, currentFilepath), { autocrlf });
|
|
5421
5519
|
if (object === null) throw new NotFoundError(currentFilepath)
|
|
5422
5520
|
const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
|
|
5423
5521
|
index.insert({ filepath: currentFilepath, stats, oid });
|
|
@@ -5716,7 +5814,7 @@ async function _commit({
|
|
|
5716
5814
|
|
|
5717
5815
|
return GitIndexManager.acquire(
|
|
5718
5816
|
{ fs, gitdir, cache, allowUnmerged: false },
|
|
5719
|
-
async function(index) {
|
|
5817
|
+
async function (index) {
|
|
5720
5818
|
const inodes = flatFileListToDirectoryStructure(index.entries);
|
|
5721
5819
|
const inode = inodes.get('.');
|
|
5722
5820
|
if (!tree) {
|
|
@@ -6080,7 +6178,7 @@ async function addNote({
|
|
|
6080
6178
|
fs: _fs,
|
|
6081
6179
|
onSign,
|
|
6082
6180
|
dir,
|
|
6083
|
-
gitdir =
|
|
6181
|
+
gitdir = join(dir, '.git'),
|
|
6084
6182
|
ref = 'refs/notes/commits',
|
|
6085
6183
|
oid,
|
|
6086
6184
|
note,
|
|
@@ -6130,6 +6228,22 @@ async function addNote({
|
|
|
6130
6228
|
}
|
|
6131
6229
|
}
|
|
6132
6230
|
|
|
6231
|
+
/*
|
|
6232
|
+
Adapted from is-git-ref-name-valid
|
|
6233
|
+
SPDX-License-Identifier: MIT
|
|
6234
|
+
Copyright © Vincent Weevers
|
|
6235
|
+
*/
|
|
6236
|
+
|
|
6237
|
+
// eslint-disable-next-line no-control-regex
|
|
6238
|
+
const bad = /(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;
|
|
6239
|
+
|
|
6240
|
+
function isValidRef(name, onelevel) {
|
|
6241
|
+
if (typeof name !== 'string')
|
|
6242
|
+
throw new TypeError('Reference name must be a string')
|
|
6243
|
+
|
|
6244
|
+
return !bad.test(name) && (!!onelevel || name.includes('/'))
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6133
6247
|
// @ts-check
|
|
6134
6248
|
|
|
6135
6249
|
/**
|
|
@@ -6144,7 +6258,7 @@ async function addNote({
|
|
|
6144
6258
|
*
|
|
6145
6259
|
*/
|
|
6146
6260
|
async function _addRemote({ fs, gitdir, remote, url, force }) {
|
|
6147
|
-
if (!
|
|
6261
|
+
if (!isValidRef(remote, true)) {
|
|
6148
6262
|
throw new InvalidRefNameError(remote, cleanGitRef.clean(remote))
|
|
6149
6263
|
}
|
|
6150
6264
|
const config = await GitConfigManager.get({ fs, gitdir });
|
|
@@ -6195,7 +6309,7 @@ async function _addRemote({ fs, gitdir, remote, url, force }) {
|
|
|
6195
6309
|
async function addRemote({
|
|
6196
6310
|
fs,
|
|
6197
6311
|
dir,
|
|
6198
|
-
gitdir =
|
|
6312
|
+
gitdir = join(dir, '.git'),
|
|
6199
6313
|
remote,
|
|
6200
6314
|
url,
|
|
6201
6315
|
force = false,
|
|
@@ -6346,7 +6460,7 @@ async function annotatedTag({
|
|
|
6346
6460
|
fs: _fs,
|
|
6347
6461
|
onSign,
|
|
6348
6462
|
dir,
|
|
6349
|
-
gitdir =
|
|
6463
|
+
gitdir = join(dir, '.git'),
|
|
6350
6464
|
ref,
|
|
6351
6465
|
tagger: _tagger,
|
|
6352
6466
|
message = ref,
|
|
@@ -6416,7 +6530,7 @@ async function _branch({
|
|
|
6416
6530
|
checkout = false,
|
|
6417
6531
|
force = false,
|
|
6418
6532
|
}) {
|
|
6419
|
-
if (!
|
|
6533
|
+
if (!isValidRef(ref, true)) {
|
|
6420
6534
|
throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
|
|
6421
6535
|
}
|
|
6422
6536
|
|
|
@@ -6477,7 +6591,7 @@ async function _branch({
|
|
|
6477
6591
|
async function branch({
|
|
6478
6592
|
fs,
|
|
6479
6593
|
dir,
|
|
6480
|
-
gitdir =
|
|
6594
|
+
gitdir = join(dir, '.git'),
|
|
6481
6595
|
ref,
|
|
6482
6596
|
object,
|
|
6483
6597
|
checkout = false,
|
|
@@ -6656,63 +6770,69 @@ async function _checkout({
|
|
|
6656
6770
|
|
|
6657
6771
|
let count = 0;
|
|
6658
6772
|
const total = ops.length;
|
|
6659
|
-
await GitIndexManager.acquire(
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6773
|
+
await GitIndexManager.acquire(
|
|
6774
|
+
{ fs, gitdir, cache },
|
|
6775
|
+
async function (index) {
|
|
6776
|
+
await Promise.all(
|
|
6777
|
+
ops
|
|
6778
|
+
.filter(
|
|
6779
|
+
([method]) => method === 'delete' || method === 'delete-index'
|
|
6780
|
+
)
|
|
6781
|
+
.map(async function ([method, fullpath]) {
|
|
6782
|
+
const filepath = `${dir}/${fullpath}`;
|
|
6783
|
+
if (method === 'delete') {
|
|
6784
|
+
await fs.rm(filepath);
|
|
6785
|
+
}
|
|
6786
|
+
index.delete({ filepath: fullpath });
|
|
6787
|
+
if (onProgress) {
|
|
6788
|
+
await onProgress({
|
|
6789
|
+
phase: 'Updating workdir',
|
|
6790
|
+
loaded: ++count,
|
|
6791
|
+
total,
|
|
6792
|
+
});
|
|
6793
|
+
}
|
|
6794
|
+
})
|
|
6795
|
+
);
|
|
6796
|
+
}
|
|
6797
|
+
);
|
|
6681
6798
|
|
|
6682
6799
|
// Note: this is cannot be done naively in parallel
|
|
6683
|
-
await GitIndexManager.acquire(
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6800
|
+
await GitIndexManager.acquire(
|
|
6801
|
+
{ fs, gitdir, cache },
|
|
6802
|
+
async function (index) {
|
|
6803
|
+
for (const [method, fullpath] of ops) {
|
|
6804
|
+
if (method === 'rmdir' || method === 'rmdir-index') {
|
|
6805
|
+
const filepath = `${dir}/${fullpath}`;
|
|
6806
|
+
try {
|
|
6807
|
+
if (method === 'rmdir') {
|
|
6808
|
+
await fs.rmdir(filepath);
|
|
6809
|
+
}
|
|
6810
|
+
index.delete({ filepath: fullpath });
|
|
6811
|
+
if (onProgress) {
|
|
6812
|
+
await onProgress({
|
|
6813
|
+
phase: 'Updating workdir',
|
|
6814
|
+
loaded: ++count,
|
|
6815
|
+
total,
|
|
6816
|
+
});
|
|
6817
|
+
}
|
|
6818
|
+
} catch (e) {
|
|
6819
|
+
if (e.code === 'ENOTEMPTY') {
|
|
6820
|
+
console.log(
|
|
6821
|
+
`Did not delete ${fullpath} because directory is not empty`
|
|
6822
|
+
);
|
|
6823
|
+
} else {
|
|
6824
|
+
throw e
|
|
6825
|
+
}
|
|
6706
6826
|
}
|
|
6707
6827
|
}
|
|
6708
6828
|
}
|
|
6709
6829
|
}
|
|
6710
|
-
|
|
6830
|
+
);
|
|
6711
6831
|
|
|
6712
6832
|
await Promise.all(
|
|
6713
6833
|
ops
|
|
6714
6834
|
.filter(([method]) => method === 'mkdir' || method === 'mkdir-index')
|
|
6715
|
-
.map(async function([_, fullpath]) {
|
|
6835
|
+
.map(async function ([_, fullpath]) {
|
|
6716
6836
|
const filepath = `${dir}/${fullpath}`;
|
|
6717
6837
|
await fs.mkdir(filepath);
|
|
6718
6838
|
if (onProgress) {
|
|
@@ -6737,14 +6857,16 @@ async function _checkout({
|
|
|
6737
6857
|
|
|
6738
6858
|
const updateWorkingDirResults = await batchAllSettled(
|
|
6739
6859
|
'Update Working Dir',
|
|
6740
|
-
eligibleOps.map(
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6860
|
+
eligibleOps.map(
|
|
6861
|
+
([method, fullpath, oid, mode, chmod]) =>
|
|
6862
|
+
() =>
|
|
6863
|
+
updateWorkingDir({ fs, cache, gitdir, dir }, [
|
|
6864
|
+
method,
|
|
6865
|
+
fullpath,
|
|
6866
|
+
oid,
|
|
6867
|
+
mode,
|
|
6868
|
+
chmod,
|
|
6869
|
+
])
|
|
6748
6870
|
),
|
|
6749
6871
|
onProgress,
|
|
6750
6872
|
batchSize
|
|
@@ -6752,11 +6874,13 @@ async function _checkout({
|
|
|
6752
6874
|
|
|
6753
6875
|
await GitIndexManager.acquire(
|
|
6754
6876
|
{ fs, gitdir, cache, allowUnmerged: true },
|
|
6755
|
-
async function(index) {
|
|
6877
|
+
async function (index) {
|
|
6756
6878
|
await batchAllSettled(
|
|
6757
6879
|
'Update Index',
|
|
6758
|
-
updateWorkingDirResults.map(
|
|
6759
|
-
|
|
6880
|
+
updateWorkingDirResults.map(
|
|
6881
|
+
([fullpath, oid, stats]) =>
|
|
6882
|
+
() =>
|
|
6883
|
+
updateIndex({ index, fullpath, oid, stats })
|
|
6760
6884
|
),
|
|
6761
6885
|
onProgress,
|
|
6762
6886
|
batchSize
|
|
@@ -6766,7 +6890,7 @@ async function _checkout({
|
|
|
6766
6890
|
} else {
|
|
6767
6891
|
await GitIndexManager.acquire(
|
|
6768
6892
|
{ fs, gitdir, cache, allowUnmerged: true },
|
|
6769
|
-
async function(index) {
|
|
6893
|
+
async function (index) {
|
|
6770
6894
|
await Promise.all(
|
|
6771
6895
|
ops
|
|
6772
6896
|
.filter(
|
|
@@ -6776,7 +6900,7 @@ async function _checkout({
|
|
|
6776
6900
|
method === 'update' ||
|
|
6777
6901
|
method === 'mkdir-index'
|
|
6778
6902
|
)
|
|
6779
|
-
.map(async function([method, fullpath, oid, mode, chmod]) {
|
|
6903
|
+
.map(async function ([method, fullpath, oid, mode, chmod]) {
|
|
6780
6904
|
const filepath = `${dir}/${fullpath}`;
|
|
6781
6905
|
try {
|
|
6782
6906
|
if (method !== 'create-index' && method !== 'mkdir-index') {
|
|
@@ -6885,7 +7009,7 @@ async function analyze({
|
|
|
6885
7009
|
dir,
|
|
6886
7010
|
gitdir,
|
|
6887
7011
|
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
6888
|
-
map: async function(fullpath, [commit, workdir, stage]) {
|
|
7012
|
+
map: async function (fullpath, [commit, workdir, stage]) {
|
|
6889
7013
|
if (fullpath === '.') return
|
|
6890
7014
|
// match against base paths
|
|
6891
7015
|
if (filepaths && !filepaths.some(base => worthWalking(fullpath, base))) {
|
|
@@ -7143,7 +7267,7 @@ async function analyze({
|
|
|
7143
7267
|
}
|
|
7144
7268
|
},
|
|
7145
7269
|
// Modify the default flat mapping
|
|
7146
|
-
reduce: async function(parent, children) {
|
|
7270
|
+
reduce: async function (parent, children) {
|
|
7147
7271
|
children = flat(children);
|
|
7148
7272
|
if (!parent) {
|
|
7149
7273
|
return children
|
|
@@ -7293,7 +7417,7 @@ async function checkout({
|
|
|
7293
7417
|
onProgress,
|
|
7294
7418
|
onPostCheckout,
|
|
7295
7419
|
dir,
|
|
7296
|
-
gitdir =
|
|
7420
|
+
gitdir = join(dir, '.git'),
|
|
7297
7421
|
remote = 'origin',
|
|
7298
7422
|
ref: _ref,
|
|
7299
7423
|
filepaths,
|
|
@@ -7337,7 +7461,7 @@ async function checkout({
|
|
|
7337
7461
|
}
|
|
7338
7462
|
|
|
7339
7463
|
// @see https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions
|
|
7340
|
-
const abbreviateRx =
|
|
7464
|
+
const abbreviateRx = /^refs\/(heads\/|tags\/|remotes\/)?(.*)/;
|
|
7341
7465
|
|
|
7342
7466
|
function abbreviateRef(ref) {
|
|
7343
7467
|
const match = abbreviateRx.exec(ref);
|
|
@@ -7944,9 +8068,9 @@ class GitShallowManager {
|
|
|
7944
8068
|
*/
|
|
7945
8069
|
static async read({ fs, gitdir }) {
|
|
7946
8070
|
if (lock$2 === null) lock$2 = new AsyncLock();
|
|
7947
|
-
const filepath =
|
|
8071
|
+
const filepath = join(gitdir, 'shallow');
|
|
7948
8072
|
const oids = new Set();
|
|
7949
|
-
await lock$2.acquire(filepath, async function() {
|
|
8073
|
+
await lock$2.acquire(filepath, async function () {
|
|
7950
8074
|
const text = await fs.read(filepath, { encoding: 'utf8' });
|
|
7951
8075
|
if (text === null) return oids // no file
|
|
7952
8076
|
if (text.trim() === '') return oids // empty file
|
|
@@ -7970,17 +8094,17 @@ class GitShallowManager {
|
|
|
7970
8094
|
*/
|
|
7971
8095
|
static async write({ fs, gitdir, oids }) {
|
|
7972
8096
|
if (lock$2 === null) lock$2 = new AsyncLock();
|
|
7973
|
-
const filepath =
|
|
8097
|
+
const filepath = join(gitdir, 'shallow');
|
|
7974
8098
|
if (oids.size > 0) {
|
|
7975
8099
|
const text = [...oids].join('\n') + '\n';
|
|
7976
|
-
await lock$2.acquire(filepath, async function() {
|
|
8100
|
+
await lock$2.acquire(filepath, async function () {
|
|
7977
8101
|
await fs.write(filepath, text, {
|
|
7978
8102
|
encoding: 'utf8',
|
|
7979
8103
|
});
|
|
7980
8104
|
});
|
|
7981
8105
|
} else {
|
|
7982
8106
|
// No shallows
|
|
7983
|
-
await lock$2.acquire(filepath, async function() {
|
|
8107
|
+
await lock$2.acquire(filepath, async function () {
|
|
7984
8108
|
await fs.rm(filepath);
|
|
7985
8109
|
});
|
|
7986
8110
|
}
|
|
@@ -8001,7 +8125,7 @@ async function hasObjectPacked({
|
|
|
8001
8125
|
}) {
|
|
8002
8126
|
// Check to see if it's in a packfile.
|
|
8003
8127
|
// Iterate through all the .idx files
|
|
8004
|
-
let list = await fs.readdir(
|
|
8128
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
8005
8129
|
list = list.filter(x => x.endsWith('.idx'));
|
|
8006
8130
|
for (const filename of list) {
|
|
8007
8131
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -8067,8 +8191,8 @@ function filterCapabilities(server, client) {
|
|
|
8067
8191
|
|
|
8068
8192
|
const pkg = {
|
|
8069
8193
|
name: 'isomorphic-git',
|
|
8070
|
-
version: '1.
|
|
8071
|
-
agent: 'git/isomorphic-git@1.
|
|
8194
|
+
version: '1.35.1',
|
|
8195
|
+
agent: 'git/isomorphic-git@1.35.1',
|
|
8072
8196
|
};
|
|
8073
8197
|
|
|
8074
8198
|
class FIFO {
|
|
@@ -8187,7 +8311,7 @@ class GitSideBand {
|
|
|
8187
8311
|
const packfile = new FIFO();
|
|
8188
8312
|
const progress = new FIFO();
|
|
8189
8313
|
// TODO: Use a proper through stream?
|
|
8190
|
-
const nextBit = async function() {
|
|
8314
|
+
const nextBit = async function () {
|
|
8191
8315
|
const line = await read();
|
|
8192
8316
|
// Skip over flush packets
|
|
8193
8317
|
if (line === null) return nextBit()
|
|
@@ -8734,7 +8858,7 @@ async function _fetch({
|
|
|
8734
8858
|
// c) compare the computed SHA with the last 20 bytes of the stream before saving to disk, and throwing a "packfile got corrupted during download" error if the SHA doesn't match.
|
|
8735
8859
|
if (packfileSha !== '' && !emptyPackfile(packfile)) {
|
|
8736
8860
|
res.packfile = `objects/pack/pack-${packfileSha}.pack`;
|
|
8737
|
-
const fullpath =
|
|
8861
|
+
const fullpath = join(gitdir, res.packfile);
|
|
8738
8862
|
await fs.write(fullpath, packfile);
|
|
8739
8863
|
const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
|
|
8740
8864
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -8764,7 +8888,7 @@ async function _init({
|
|
|
8764
8888
|
fs,
|
|
8765
8889
|
bare = false,
|
|
8766
8890
|
dir,
|
|
8767
|
-
gitdir = bare ? dir :
|
|
8891
|
+
gitdir = bare ? dir : join(dir, '.git'),
|
|
8768
8892
|
defaultBranch = 'master',
|
|
8769
8893
|
}) {
|
|
8770
8894
|
// Don't overwrite an existing config
|
|
@@ -8970,7 +9094,7 @@ async function clone({
|
|
|
8970
9094
|
onAuthFailure,
|
|
8971
9095
|
onPostCheckout,
|
|
8972
9096
|
dir,
|
|
8973
|
-
gitdir =
|
|
9097
|
+
gitdir = join(dir, '.git'),
|
|
8974
9098
|
url,
|
|
8975
9099
|
corsProxy = undefined,
|
|
8976
9100
|
ref = undefined,
|
|
@@ -9077,7 +9201,7 @@ async function commit({
|
|
|
9077
9201
|
fs: _fs,
|
|
9078
9202
|
onSign,
|
|
9079
9203
|
dir,
|
|
9080
|
-
gitdir =
|
|
9204
|
+
gitdir = join(dir, '.git'),
|
|
9081
9205
|
message,
|
|
9082
9206
|
author,
|
|
9083
9207
|
committer,
|
|
@@ -9149,7 +9273,7 @@ async function commit({
|
|
|
9149
9273
|
async function currentBranch({
|
|
9150
9274
|
fs,
|
|
9151
9275
|
dir,
|
|
9152
|
-
gitdir =
|
|
9276
|
+
gitdir = join(dir, '.git'),
|
|
9153
9277
|
fullname = false,
|
|
9154
9278
|
test = false,
|
|
9155
9279
|
}) {
|
|
@@ -9226,7 +9350,7 @@ async function _deleteBranch({ fs, gitdir, ref }) {
|
|
|
9226
9350
|
async function deleteBranch({
|
|
9227
9351
|
fs,
|
|
9228
9352
|
dir,
|
|
9229
|
-
gitdir =
|
|
9353
|
+
gitdir = join(dir, '.git'),
|
|
9230
9354
|
ref,
|
|
9231
9355
|
}) {
|
|
9232
9356
|
try {
|
|
@@ -9261,7 +9385,7 @@ async function deleteBranch({
|
|
|
9261
9385
|
* console.log('done')
|
|
9262
9386
|
*
|
|
9263
9387
|
*/
|
|
9264
|
-
async function deleteRef({ fs, dir, gitdir =
|
|
9388
|
+
async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
9265
9389
|
try {
|
|
9266
9390
|
assertParameter('fs', fs);
|
|
9267
9391
|
assertParameter('ref', ref);
|
|
@@ -9309,7 +9433,7 @@ async function _deleteRemote({ fs, gitdir, remote }) {
|
|
|
9309
9433
|
async function deleteRemote({
|
|
9310
9434
|
fs,
|
|
9311
9435
|
dir,
|
|
9312
|
-
gitdir =
|
|
9436
|
+
gitdir = join(dir, '.git'),
|
|
9313
9437
|
remote,
|
|
9314
9438
|
}) {
|
|
9315
9439
|
try {
|
|
@@ -9366,7 +9490,7 @@ async function _deleteTag({ fs, gitdir, ref }) {
|
|
|
9366
9490
|
* console.log('done')
|
|
9367
9491
|
*
|
|
9368
9492
|
*/
|
|
9369
|
-
async function deleteTag({ fs, dir, gitdir =
|
|
9493
|
+
async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
9370
9494
|
try {
|
|
9371
9495
|
assertParameter('fs', fs);
|
|
9372
9496
|
assertParameter('ref', ref);
|
|
@@ -9398,7 +9522,7 @@ async function expandOidPacked({
|
|
|
9398
9522
|
}) {
|
|
9399
9523
|
// Iterate through all the .pack files
|
|
9400
9524
|
const results = [];
|
|
9401
|
-
let list = await fs.readdir(
|
|
9525
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
9402
9526
|
list = list.filter(x => x.endsWith('.idx'));
|
|
9403
9527
|
for (const filename of list) {
|
|
9404
9528
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -9468,7 +9592,7 @@ async function _expandOid({ fs, cache, gitdir, oid: short }) {
|
|
|
9468
9592
|
async function expandOid({
|
|
9469
9593
|
fs,
|
|
9470
9594
|
dir,
|
|
9471
|
-
gitdir =
|
|
9595
|
+
gitdir = join(dir, '.git'),
|
|
9472
9596
|
oid,
|
|
9473
9597
|
cache = {},
|
|
9474
9598
|
}) {
|
|
@@ -9506,7 +9630,7 @@ async function expandOid({
|
|
|
9506
9630
|
* console.log(fullRef)
|
|
9507
9631
|
*
|
|
9508
9632
|
*/
|
|
9509
|
-
async function expandRef({ fs, dir, gitdir =
|
|
9633
|
+
async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
9510
9634
|
try {
|
|
9511
9635
|
assertParameter('fs', fs);
|
|
9512
9636
|
assertParameter('gitdir', gitdir);
|
|
@@ -9646,7 +9770,7 @@ async function mergeTree({
|
|
|
9646
9770
|
fs,
|
|
9647
9771
|
cache,
|
|
9648
9772
|
dir,
|
|
9649
|
-
gitdir =
|
|
9773
|
+
gitdir = join(dir, '.git'),
|
|
9650
9774
|
index,
|
|
9651
9775
|
ourOid,
|
|
9652
9776
|
baseOid,
|
|
@@ -9673,7 +9797,7 @@ async function mergeTree({
|
|
|
9673
9797
|
dir,
|
|
9674
9798
|
gitdir,
|
|
9675
9799
|
trees: [ourTree, baseTree, theirTree],
|
|
9676
|
-
map: async function(filepath, [ours, base, theirs]) {
|
|
9800
|
+
map: async function (filepath, [ours, base, theirs]) {
|
|
9677
9801
|
const path = basename(filepath);
|
|
9678
9802
|
// What we did, what they did
|
|
9679
9803
|
const ourChange = await modified(ours, base);
|
|
@@ -9910,7 +10034,7 @@ async function mergeTree({
|
|
|
9910
10034
|
dir,
|
|
9911
10035
|
gitdir,
|
|
9912
10036
|
trees: [TREE({ ref: results.oid })],
|
|
9913
|
-
map: async function(filepath, [entry]) {
|
|
10037
|
+
map: async function (filepath, [entry]) {
|
|
9914
10038
|
const path = `${dir}/${filepath}`;
|
|
9915
10039
|
if ((await entry.type()) === 'blob') {
|
|
9916
10040
|
const mode = await entry.mode();
|
|
@@ -10368,7 +10492,7 @@ async function fastForward({
|
|
|
10368
10492
|
onAuthSuccess,
|
|
10369
10493
|
onAuthFailure,
|
|
10370
10494
|
dir,
|
|
10371
|
-
gitdir =
|
|
10495
|
+
gitdir = join(dir, '.git'),
|
|
10372
10496
|
ref,
|
|
10373
10497
|
url,
|
|
10374
10498
|
remote,
|
|
@@ -10487,7 +10611,7 @@ async function fetch({
|
|
|
10487
10611
|
onAuthSuccess,
|
|
10488
10612
|
onAuthFailure,
|
|
10489
10613
|
dir,
|
|
10490
|
-
gitdir =
|
|
10614
|
+
gitdir = join(dir, '.git'),
|
|
10491
10615
|
ref,
|
|
10492
10616
|
remote,
|
|
10493
10617
|
remoteRef,
|
|
@@ -10556,7 +10680,7 @@ async function fetch({
|
|
|
10556
10680
|
async function findMergeBase({
|
|
10557
10681
|
fs,
|
|
10558
10682
|
dir,
|
|
10559
|
-
gitdir =
|
|
10683
|
+
gitdir = join(dir, '.git'),
|
|
10560
10684
|
oids,
|
|
10561
10685
|
cache = {},
|
|
10562
10686
|
}) {
|
|
@@ -10591,7 +10715,7 @@ async function findMergeBase({
|
|
|
10591
10715
|
* @returns {Promise<string>} Resolves successfully with a root git directory path
|
|
10592
10716
|
*/
|
|
10593
10717
|
async function _findRoot({ fs, filepath }) {
|
|
10594
|
-
if (await fs.exists(
|
|
10718
|
+
if (await fs.exists(join(filepath, '.git'))) {
|
|
10595
10719
|
return filepath
|
|
10596
10720
|
} else {
|
|
10597
10721
|
const parent = dirname(filepath);
|
|
@@ -10663,7 +10787,7 @@ async function findRoot({ fs, filepath }) {
|
|
|
10663
10787
|
* console.log(value)
|
|
10664
10788
|
*
|
|
10665
10789
|
*/
|
|
10666
|
-
async function getConfig({ fs, dir, gitdir =
|
|
10790
|
+
async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {
|
|
10667
10791
|
try {
|
|
10668
10792
|
assertParameter('fs', fs);
|
|
10669
10793
|
assertParameter('gitdir', gitdir);
|
|
@@ -10717,7 +10841,7 @@ async function _getConfigAll({ fs, gitdir, path }) {
|
|
|
10717
10841
|
async function getConfigAll({
|
|
10718
10842
|
fs,
|
|
10719
10843
|
dir,
|
|
10720
|
-
gitdir =
|
|
10844
|
+
gitdir = join(dir, '.git'),
|
|
10721
10845
|
path,
|
|
10722
10846
|
}) {
|
|
10723
10847
|
try {
|
|
@@ -11083,7 +11207,7 @@ async function _indexPack({
|
|
|
11083
11207
|
filepath,
|
|
11084
11208
|
}) {
|
|
11085
11209
|
try {
|
|
11086
|
-
filepath =
|
|
11210
|
+
filepath = join(dir, filepath);
|
|
11087
11211
|
const pack = await fs.read(filepath);
|
|
11088
11212
|
const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
|
|
11089
11213
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -11136,7 +11260,7 @@ async function indexPack({
|
|
|
11136
11260
|
fs,
|
|
11137
11261
|
onProgress,
|
|
11138
11262
|
dir,
|
|
11139
|
-
gitdir =
|
|
11263
|
+
gitdir = join(dir, '.git'),
|
|
11140
11264
|
filepath,
|
|
11141
11265
|
cache = {},
|
|
11142
11266
|
}) {
|
|
@@ -11182,7 +11306,7 @@ async function init({
|
|
|
11182
11306
|
fs,
|
|
11183
11307
|
bare = false,
|
|
11184
11308
|
dir,
|
|
11185
|
-
gitdir = bare ? dir :
|
|
11309
|
+
gitdir = bare ? dir : join(dir, '.git'),
|
|
11186
11310
|
defaultBranch = 'master',
|
|
11187
11311
|
}) {
|
|
11188
11312
|
try {
|
|
@@ -11303,7 +11427,7 @@ async function _isDescendent({
|
|
|
11303
11427
|
async function isDescendent({
|
|
11304
11428
|
fs,
|
|
11305
11429
|
dir,
|
|
11306
|
-
gitdir =
|
|
11430
|
+
gitdir = join(dir, '.git'),
|
|
11307
11431
|
oid,
|
|
11308
11432
|
ancestor,
|
|
11309
11433
|
depth = -1,
|
|
@@ -11349,7 +11473,7 @@ async function isDescendent({
|
|
|
11349
11473
|
async function isIgnored({
|
|
11350
11474
|
fs,
|
|
11351
11475
|
dir,
|
|
11352
|
-
gitdir =
|
|
11476
|
+
gitdir = join(dir, '.git'),
|
|
11353
11477
|
filepath,
|
|
11354
11478
|
}) {
|
|
11355
11479
|
try {
|
|
@@ -11402,7 +11526,7 @@ async function isIgnored({
|
|
|
11402
11526
|
async function listBranches({
|
|
11403
11527
|
fs,
|
|
11404
11528
|
dir,
|
|
11405
|
-
gitdir =
|
|
11529
|
+
gitdir = join(dir, '.git'),
|
|
11406
11530
|
remote,
|
|
11407
11531
|
}) {
|
|
11408
11532
|
try {
|
|
@@ -11445,11 +11569,12 @@ async function _listFiles({ fs, gitdir, ref, cache }) {
|
|
|
11445
11569
|
});
|
|
11446
11570
|
return filenames
|
|
11447
11571
|
} else {
|
|
11448
|
-
return GitIndexManager.acquire(
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11572
|
+
return GitIndexManager.acquire(
|
|
11573
|
+
{ fs, gitdir, cache },
|
|
11574
|
+
async function (index) {
|
|
11575
|
+
return index.entries.map(x => x.path)
|
|
11576
|
+
}
|
|
11577
|
+
)
|
|
11453
11578
|
}
|
|
11454
11579
|
}
|
|
11455
11580
|
|
|
@@ -11471,10 +11596,10 @@ async function accumulateFilesFromOid({
|
|
|
11471
11596
|
gitdir,
|
|
11472
11597
|
oid: entry.oid,
|
|
11473
11598
|
filenames,
|
|
11474
|
-
prefix:
|
|
11599
|
+
prefix: join(prefix, entry.path),
|
|
11475
11600
|
});
|
|
11476
11601
|
} else {
|
|
11477
|
-
filenames.push(
|
|
11602
|
+
filenames.push(join(prefix, entry.path));
|
|
11478
11603
|
}
|
|
11479
11604
|
}
|
|
11480
11605
|
}
|
|
@@ -11508,7 +11633,7 @@ async function accumulateFilesFromOid({
|
|
|
11508
11633
|
async function listFiles({
|
|
11509
11634
|
fs,
|
|
11510
11635
|
dir,
|
|
11511
|
-
gitdir =
|
|
11636
|
+
gitdir = join(dir, '.git'),
|
|
11512
11637
|
ref,
|
|
11513
11638
|
cache = {},
|
|
11514
11639
|
}) {
|
|
@@ -11587,7 +11712,7 @@ async function _listNotes({ fs, cache, gitdir, ref }) {
|
|
|
11587
11712
|
async function listNotes({
|
|
11588
11713
|
fs,
|
|
11589
11714
|
dir,
|
|
11590
|
-
gitdir =
|
|
11715
|
+
gitdir = join(dir, '.git'),
|
|
11591
11716
|
ref = 'refs/notes/commits',
|
|
11592
11717
|
cache = {},
|
|
11593
11718
|
}) {
|
|
@@ -11629,7 +11754,7 @@ async function listNotes({
|
|
|
11629
11754
|
async function listRefs({
|
|
11630
11755
|
fs,
|
|
11631
11756
|
dir,
|
|
11632
|
-
gitdir =
|
|
11757
|
+
gitdir = join(dir, '.git'),
|
|
11633
11758
|
filepath,
|
|
11634
11759
|
}) {
|
|
11635
11760
|
try {
|
|
@@ -11680,7 +11805,7 @@ async function _listRemotes({ fs, gitdir }) {
|
|
|
11680
11805
|
* console.log(remotes)
|
|
11681
11806
|
*
|
|
11682
11807
|
*/
|
|
11683
|
-
async function listRemotes({ fs, dir, gitdir =
|
|
11808
|
+
async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
11684
11809
|
try {
|
|
11685
11810
|
assertParameter('fs', fs);
|
|
11686
11811
|
assertParameter('gitdir', gitdir);
|
|
@@ -11924,7 +12049,7 @@ async function listServerRefs({
|
|
|
11924
12049
|
* console.log(tags)
|
|
11925
12050
|
*
|
|
11926
12051
|
*/
|
|
11927
|
-
async function listTags({ fs, dir, gitdir =
|
|
12052
|
+
async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
11928
12053
|
try {
|
|
11929
12054
|
assertParameter('fs', fs);
|
|
11930
12055
|
assertParameter('gitdir', gitdir);
|
|
@@ -11979,10 +12104,10 @@ async function _resolveFileId({
|
|
|
11979
12104
|
filepaths = [],
|
|
11980
12105
|
parentPath = '',
|
|
11981
12106
|
}) {
|
|
11982
|
-
const walks = tree.entries().map(function(entry) {
|
|
12107
|
+
const walks = tree.entries().map(function (entry) {
|
|
11983
12108
|
let result;
|
|
11984
12109
|
if (entry.oid === fileId) {
|
|
11985
|
-
result =
|
|
12110
|
+
result = join(parentPath, entry.path);
|
|
11986
12111
|
filepaths.push(result);
|
|
11987
12112
|
} else if (entry.type === 'tree') {
|
|
11988
12113
|
result = _readObject({
|
|
@@ -11990,7 +12115,7 @@ async function _resolveFileId({
|
|
|
11990
12115
|
cache,
|
|
11991
12116
|
gitdir,
|
|
11992
12117
|
oid: entry.oid,
|
|
11993
|
-
}).then(function({ object }) {
|
|
12118
|
+
}).then(function ({ object }) {
|
|
11994
12119
|
return _resolveFileId({
|
|
11995
12120
|
fs,
|
|
11996
12121
|
cache,
|
|
@@ -11999,7 +12124,7 @@ async function _resolveFileId({
|
|
|
11999
12124
|
fileId,
|
|
12000
12125
|
oid,
|
|
12001
12126
|
filepaths,
|
|
12002
|
-
parentPath:
|
|
12127
|
+
parentPath: join(parentPath, entry.path),
|
|
12003
12128
|
})
|
|
12004
12129
|
});
|
|
12005
12130
|
}
|
|
@@ -12209,7 +12334,7 @@ async function _log({
|
|
|
12209
12334
|
async function log({
|
|
12210
12335
|
fs,
|
|
12211
12336
|
dir,
|
|
12212
|
-
gitdir =
|
|
12337
|
+
gitdir = join(dir, '.git'),
|
|
12213
12338
|
filepath,
|
|
12214
12339
|
ref = 'HEAD',
|
|
12215
12340
|
depth,
|
|
@@ -12358,7 +12483,7 @@ async function merge({
|
|
|
12358
12483
|
fs: _fs,
|
|
12359
12484
|
onSign,
|
|
12360
12485
|
dir,
|
|
12361
|
-
gitdir =
|
|
12486
|
+
gitdir = join(dir, '.git'),
|
|
12362
12487
|
ours,
|
|
12363
12488
|
theirs,
|
|
12364
12489
|
fastForward = true,
|
|
@@ -12446,7 +12571,7 @@ async function _pack({
|
|
|
12446
12571
|
fs,
|
|
12447
12572
|
cache,
|
|
12448
12573
|
dir,
|
|
12449
|
-
gitdir =
|
|
12574
|
+
gitdir = join(dir, '.git'),
|
|
12450
12575
|
oids,
|
|
12451
12576
|
}) {
|
|
12452
12577
|
const hash = new Hash();
|
|
@@ -12522,7 +12647,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
|
|
|
12522
12647
|
const packfileSha = packfile.slice(-20).toString('hex');
|
|
12523
12648
|
const filename = `pack-${packfileSha}.pack`;
|
|
12524
12649
|
if (write) {
|
|
12525
|
-
await fs.write(
|
|
12650
|
+
await fs.write(join(gitdir, `objects/pack/${filename}`), packfile);
|
|
12526
12651
|
return { filename }
|
|
12527
12652
|
}
|
|
12528
12653
|
return {
|
|
@@ -12567,7 +12692,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
|
|
|
12567
12692
|
async function packObjects({
|
|
12568
12693
|
fs,
|
|
12569
12694
|
dir,
|
|
12570
|
-
gitdir =
|
|
12695
|
+
gitdir = join(dir, '.git'),
|
|
12571
12696
|
oids,
|
|
12572
12697
|
write = false,
|
|
12573
12698
|
cache = {},
|
|
@@ -12651,7 +12776,7 @@ async function pull({
|
|
|
12651
12776
|
onAuthSuccess,
|
|
12652
12777
|
onAuthFailure,
|
|
12653
12778
|
dir,
|
|
12654
|
-
gitdir =
|
|
12779
|
+
gitdir = join(dir, '.git'),
|
|
12655
12780
|
ref,
|
|
12656
12781
|
url,
|
|
12657
12782
|
remote,
|
|
@@ -12731,7 +12856,7 @@ async function listCommitsAndTags({
|
|
|
12731
12856
|
fs,
|
|
12732
12857
|
cache,
|
|
12733
12858
|
dir,
|
|
12734
|
-
gitdir =
|
|
12859
|
+
gitdir = join(dir, '.git'),
|
|
12735
12860
|
start,
|
|
12736
12861
|
finish,
|
|
12737
12862
|
}) {
|
|
@@ -12794,7 +12919,7 @@ async function listObjects({
|
|
|
12794
12919
|
fs,
|
|
12795
12920
|
cache,
|
|
12796
12921
|
dir,
|
|
12797
|
-
gitdir =
|
|
12922
|
+
gitdir = join(dir, '.git'),
|
|
12798
12923
|
oids,
|
|
12799
12924
|
}) {
|
|
12800
12925
|
const visited = new Set();
|
|
@@ -13014,7 +13139,7 @@ async function _push({
|
|
|
13014
13139
|
const hookCancel = await onPrePush({
|
|
13015
13140
|
remote,
|
|
13016
13141
|
url,
|
|
13017
|
-
localRef: { ref: _delete ? '(delete)' : fullRef, oid
|
|
13142
|
+
localRef: { ref: _delete ? '(delete)' : fullRef, oid },
|
|
13018
13143
|
remoteRef: { ref: fullRemoteRef, oid: oldoid },
|
|
13019
13144
|
});
|
|
13020
13145
|
if (!hookCancel) throw new UserCanceledError()
|
|
@@ -13241,7 +13366,7 @@ async function push({
|
|
|
13241
13366
|
onAuthFailure,
|
|
13242
13367
|
onPrePush,
|
|
13243
13368
|
dir,
|
|
13244
|
-
gitdir =
|
|
13369
|
+
gitdir = join(dir, '.git'),
|
|
13245
13370
|
ref,
|
|
13246
13371
|
remoteRef,
|
|
13247
13372
|
remote = 'origin',
|
|
@@ -13376,7 +13501,7 @@ async function _readBlob({
|
|
|
13376
13501
|
async function readBlob({
|
|
13377
13502
|
fs,
|
|
13378
13503
|
dir,
|
|
13379
|
-
gitdir =
|
|
13504
|
+
gitdir = join(dir, '.git'),
|
|
13380
13505
|
oid,
|
|
13381
13506
|
filepath,
|
|
13382
13507
|
cache = {},
|
|
@@ -13426,7 +13551,7 @@ async function readBlob({
|
|
|
13426
13551
|
async function readCommit({
|
|
13427
13552
|
fs,
|
|
13428
13553
|
dir,
|
|
13429
|
-
gitdir =
|
|
13554
|
+
gitdir = join(dir, '.git'),
|
|
13430
13555
|
oid,
|
|
13431
13556
|
cache = {},
|
|
13432
13557
|
}) {
|
|
@@ -13500,7 +13625,7 @@ async function _readNote({
|
|
|
13500
13625
|
async function readNote({
|
|
13501
13626
|
fs,
|
|
13502
13627
|
dir,
|
|
13503
|
-
gitdir =
|
|
13628
|
+
gitdir = join(dir, '.git'),
|
|
13504
13629
|
ref = 'refs/notes/commits',
|
|
13505
13630
|
oid,
|
|
13506
13631
|
cache = {},
|
|
@@ -13717,7 +13842,7 @@ async function readNote({
|
|
|
13717
13842
|
async function readObject({
|
|
13718
13843
|
fs: _fs,
|
|
13719
13844
|
dir,
|
|
13720
|
-
gitdir =
|
|
13845
|
+
gitdir = join(dir, '.git'),
|
|
13721
13846
|
oid,
|
|
13722
13847
|
format = 'parsed',
|
|
13723
13848
|
filepath = undefined,
|
|
@@ -13854,7 +13979,7 @@ async function _readTag({ fs, cache, gitdir, oid }) {
|
|
|
13854
13979
|
async function readTag({
|
|
13855
13980
|
fs,
|
|
13856
13981
|
dir,
|
|
13857
|
-
gitdir =
|
|
13982
|
+
gitdir = join(dir, '.git'),
|
|
13858
13983
|
oid,
|
|
13859
13984
|
cache = {},
|
|
13860
13985
|
}) {
|
|
@@ -13904,7 +14029,7 @@ async function readTag({
|
|
|
13904
14029
|
async function readTree({
|
|
13905
14030
|
fs,
|
|
13906
14031
|
dir,
|
|
13907
|
-
gitdir =
|
|
14032
|
+
gitdir = join(dir, '.git'),
|
|
13908
14033
|
oid,
|
|
13909
14034
|
filepath = undefined,
|
|
13910
14035
|
cache = {},
|
|
@@ -13951,7 +14076,7 @@ async function readTree({
|
|
|
13951
14076
|
async function remove({
|
|
13952
14077
|
fs: _fs,
|
|
13953
14078
|
dir,
|
|
13954
|
-
gitdir =
|
|
14079
|
+
gitdir = join(dir, '.git'),
|
|
13955
14080
|
filepath,
|
|
13956
14081
|
cache = {},
|
|
13957
14082
|
}) {
|
|
@@ -13962,7 +14087,7 @@ async function remove({
|
|
|
13962
14087
|
|
|
13963
14088
|
await GitIndexManager.acquire(
|
|
13964
14089
|
{ fs: new FileSystem(_fs), gitdir, cache },
|
|
13965
|
-
async function(index) {
|
|
14090
|
+
async function (index) {
|
|
13966
14091
|
index.delete({ filepath });
|
|
13967
14092
|
}
|
|
13968
14093
|
);
|
|
@@ -14022,6 +14147,7 @@ async function _removeNote({
|
|
|
14022
14147
|
// I'm using the "empty tree" magic number here for brevity
|
|
14023
14148
|
const result = await _readTree({
|
|
14024
14149
|
fs,
|
|
14150
|
+
cache,
|
|
14025
14151
|
gitdir,
|
|
14026
14152
|
oid: parent || '4b825dc642cb6eb9a060e54bf8d69288fbee4904',
|
|
14027
14153
|
});
|
|
@@ -14087,7 +14213,7 @@ async function removeNote({
|
|
|
14087
14213
|
fs: _fs,
|
|
14088
14214
|
onSign,
|
|
14089
14215
|
dir,
|
|
14090
|
-
gitdir =
|
|
14216
|
+
gitdir = join(dir, '.git'),
|
|
14091
14217
|
ref = 'refs/notes/commits',
|
|
14092
14218
|
oid,
|
|
14093
14219
|
author: _author,
|
|
@@ -14151,11 +14277,11 @@ async function _renameBranch({
|
|
|
14151
14277
|
ref,
|
|
14152
14278
|
checkout = false,
|
|
14153
14279
|
}) {
|
|
14154
|
-
if (!
|
|
14280
|
+
if (!isValidRef(ref, true)) {
|
|
14155
14281
|
throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
|
|
14156
14282
|
}
|
|
14157
14283
|
|
|
14158
|
-
if (!
|
|
14284
|
+
if (!isValidRef(oldref, true)) {
|
|
14159
14285
|
throw new InvalidRefNameError(oldref, cleanGitRef.clean(oldref))
|
|
14160
14286
|
}
|
|
14161
14287
|
|
|
@@ -14219,7 +14345,7 @@ async function _renameBranch({
|
|
|
14219
14345
|
async function renameBranch({
|
|
14220
14346
|
fs,
|
|
14221
14347
|
dir,
|
|
14222
|
-
gitdir =
|
|
14348
|
+
gitdir = join(dir, '.git'),
|
|
14223
14349
|
ref,
|
|
14224
14350
|
oldref,
|
|
14225
14351
|
checkout = false,
|
|
@@ -14271,7 +14397,7 @@ async function hashObject$1({ gitdir, type, object }) {
|
|
|
14271
14397
|
async function resetIndex({
|
|
14272
14398
|
fs: _fs,
|
|
14273
14399
|
dir,
|
|
14274
|
-
gitdir =
|
|
14400
|
+
gitdir = join(dir, '.git'),
|
|
14275
14401
|
filepath,
|
|
14276
14402
|
ref,
|
|
14277
14403
|
cache = {},
|
|
@@ -14326,7 +14452,7 @@ async function resetIndex({
|
|
|
14326
14452
|
size: 0,
|
|
14327
14453
|
};
|
|
14328
14454
|
// If the file exists in the workdir...
|
|
14329
|
-
const object = dir && (await fs.read(
|
|
14455
|
+
const object = dir && (await fs.read(join(dir, filepath)));
|
|
14330
14456
|
if (object) {
|
|
14331
14457
|
// ... and has the same hash as the desired state...
|
|
14332
14458
|
workdirOid = await hashObject$1({
|
|
@@ -14336,15 +14462,18 @@ async function resetIndex({
|
|
|
14336
14462
|
});
|
|
14337
14463
|
if (oid === workdirOid) {
|
|
14338
14464
|
// ... use the workdir Stats object
|
|
14339
|
-
stats = await fs.lstat(
|
|
14465
|
+
stats = await fs.lstat(join(dir, filepath));
|
|
14340
14466
|
}
|
|
14341
14467
|
}
|
|
14342
|
-
await GitIndexManager.acquire(
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
index.
|
|
14468
|
+
await GitIndexManager.acquire(
|
|
14469
|
+
{ fs, gitdir, cache },
|
|
14470
|
+
async function (index) {
|
|
14471
|
+
index.delete({ filepath });
|
|
14472
|
+
if (oid) {
|
|
14473
|
+
index.insert({ filepath, stats, oid });
|
|
14474
|
+
}
|
|
14346
14475
|
}
|
|
14347
|
-
|
|
14476
|
+
);
|
|
14348
14477
|
} catch (err) {
|
|
14349
14478
|
err.caller = 'git.reset';
|
|
14350
14479
|
throw err
|
|
@@ -14375,7 +14504,7 @@ async function resetIndex({
|
|
|
14375
14504
|
async function resolveRef({
|
|
14376
14505
|
fs,
|
|
14377
14506
|
dir,
|
|
14378
|
-
gitdir =
|
|
14507
|
+
gitdir = join(dir, '.git'),
|
|
14379
14508
|
ref,
|
|
14380
14509
|
depth,
|
|
14381
14510
|
}) {
|
|
@@ -14444,7 +14573,7 @@ async function resolveRef({
|
|
|
14444
14573
|
async function setConfig({
|
|
14445
14574
|
fs: _fs,
|
|
14446
14575
|
dir,
|
|
14447
|
-
gitdir =
|
|
14576
|
+
gitdir = join(dir, '.git'),
|
|
14448
14577
|
path,
|
|
14449
14578
|
value,
|
|
14450
14579
|
append = false,
|
|
@@ -14542,7 +14671,7 @@ async function acquireLock$1(ref, callback) {
|
|
|
14542
14671
|
|
|
14543
14672
|
// make sure filepath, blob type and blob object (from loose objects) plus oid are in sync and valid
|
|
14544
14673
|
async function checkAndWriteBlob(fs, gitdir, dir, filepath, oid = null) {
|
|
14545
|
-
const currentFilepath =
|
|
14674
|
+
const currentFilepath = join(dir, filepath);
|
|
14546
14675
|
const stats = await fs.lstat(currentFilepath);
|
|
14547
14676
|
if (!stats) throw new NotFoundError(currentFilepath)
|
|
14548
14677
|
if (stats.isDirectory())
|
|
@@ -14758,7 +14887,7 @@ async function applyTreeChanges({
|
|
|
14758
14887
|
stageUpdated.push({
|
|
14759
14888
|
filepath,
|
|
14760
14889
|
oid,
|
|
14761
|
-
stats: await fs.lstat(
|
|
14890
|
+
stats: await fs.lstat(join(dir, filepath)),
|
|
14762
14891
|
});
|
|
14763
14892
|
return {
|
|
14764
14893
|
method: 'write',
|
|
@@ -14773,7 +14902,7 @@ async function applyTreeChanges({
|
|
|
14773
14902
|
// apply the changes to work dir
|
|
14774
14903
|
await acquireLock$1({ fs, gitdir, dirRemoved, ops }, async () => {
|
|
14775
14904
|
for (const op of ops) {
|
|
14776
|
-
const currentFilepath =
|
|
14905
|
+
const currentFilepath = join(dir, op.filepath);
|
|
14777
14906
|
switch (op.method) {
|
|
14778
14907
|
case 'rmdir':
|
|
14779
14908
|
await fs.rmdir(currentFilepath);
|
|
@@ -14825,7 +14954,7 @@ class GitStashManager {
|
|
|
14825
14954
|
* @param {string} args.dir - The working directory.
|
|
14826
14955
|
* @param {string}[args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
14827
14956
|
*/
|
|
14828
|
-
constructor({ fs, dir, gitdir =
|
|
14957
|
+
constructor({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
14829
14958
|
Object.assign(this, {
|
|
14830
14959
|
fs,
|
|
14831
14960
|
dir,
|
|
@@ -14858,7 +14987,7 @@ class GitStashManager {
|
|
|
14858
14987
|
* @returns {string} - The file path for the stash reference.
|
|
14859
14988
|
*/
|
|
14860
14989
|
get refStashPath() {
|
|
14861
|
-
return
|
|
14990
|
+
return join(this.gitdir, GitStashManager.refStash)
|
|
14862
14991
|
}
|
|
14863
14992
|
|
|
14864
14993
|
/**
|
|
@@ -14867,7 +14996,7 @@ class GitStashManager {
|
|
|
14867
14996
|
* @returns {string} - The file path for the stash reflogs.
|
|
14868
14997
|
*/
|
|
14869
14998
|
get refLogsStashPath() {
|
|
14870
|
-
return
|
|
14999
|
+
return join(this.gitdir, GitStashManager.refLogsStash)
|
|
14871
15000
|
}
|
|
14872
15001
|
|
|
14873
15002
|
/**
|
|
@@ -15210,9 +15339,8 @@ async function _stashDrop({ fs, dir, gitdir, refIdx = 0 }) {
|
|
|
15210
15339
|
reflogEntries.reverse().join('\n') + '\n',
|
|
15211
15340
|
'utf8'
|
|
15212
15341
|
);
|
|
15213
|
-
const lastStashCommit =
|
|
15214
|
-
' '
|
|
15215
|
-
)[1];
|
|
15342
|
+
const lastStashCommit =
|
|
15343
|
+
reflogEntries[reflogEntries.length - 1].split(' ')[1];
|
|
15216
15344
|
await stashMgr.writeStashRef(lastStashCommit);
|
|
15217
15345
|
} else {
|
|
15218
15346
|
// remove the stash reflog file if no entry left
|
|
@@ -15308,7 +15436,7 @@ async function _stashPop({ fs, dir, gitdir, refIdx = 0 }) {
|
|
|
15308
15436
|
async function stash({
|
|
15309
15437
|
fs,
|
|
15310
15438
|
dir,
|
|
15311
|
-
gitdir =
|
|
15439
|
+
gitdir = join(dir, '.git'),
|
|
15312
15440
|
op = 'push',
|
|
15313
15441
|
message = '',
|
|
15314
15442
|
refIdx = 0,
|
|
@@ -15334,7 +15462,7 @@ async function stash({
|
|
|
15334
15462
|
const _fs = new FileSystem(fs);
|
|
15335
15463
|
const folders = ['refs', 'logs', 'logs/refs'];
|
|
15336
15464
|
folders
|
|
15337
|
-
.map(f =>
|
|
15465
|
+
.map(f => join(gitdir, f))
|
|
15338
15466
|
.forEach(async folder => {
|
|
15339
15467
|
if (!(await _fs.exists(folder))) {
|
|
15340
15468
|
await _fs.mkdir(folder);
|
|
@@ -15398,7 +15526,7 @@ async function stash({
|
|
|
15398
15526
|
async function status({
|
|
15399
15527
|
fs: _fs,
|
|
15400
15528
|
dir,
|
|
15401
|
-
gitdir =
|
|
15529
|
+
gitdir = join(dir, '.git'),
|
|
15402
15530
|
filepath,
|
|
15403
15531
|
cache = {},
|
|
15404
15532
|
}) {
|
|
@@ -15427,14 +15555,14 @@ async function status({
|
|
|
15427
15555
|
});
|
|
15428
15556
|
const indexEntry = await GitIndexManager.acquire(
|
|
15429
15557
|
{ fs, gitdir, cache },
|
|
15430
|
-
async function(index) {
|
|
15558
|
+
async function (index) {
|
|
15431
15559
|
for (const entry of index) {
|
|
15432
15560
|
if (entry.path === filepath) return entry
|
|
15433
15561
|
}
|
|
15434
15562
|
return null
|
|
15435
15563
|
}
|
|
15436
15564
|
);
|
|
15437
|
-
const stats = await fs.lstat(
|
|
15565
|
+
const stats = await fs.lstat(join(dir, filepath));
|
|
15438
15566
|
|
|
15439
15567
|
const H = treeOid !== null; // head
|
|
15440
15568
|
const I = indexEntry !== null; // index
|
|
@@ -15444,7 +15572,7 @@ async function status({
|
|
|
15444
15572
|
if (I && !compareStats(indexEntry, stats)) {
|
|
15445
15573
|
return indexEntry.oid
|
|
15446
15574
|
} else {
|
|
15447
|
-
const object = await fs.read(
|
|
15575
|
+
const object = await fs.read(join(dir, filepath));
|
|
15448
15576
|
const workdirOid = await hashObject$1({
|
|
15449
15577
|
gitdir,
|
|
15450
15578
|
type: 'blob',
|
|
@@ -15457,11 +15585,12 @@ async function status({
|
|
|
15457
15585
|
// (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat
|
|
15458
15586
|
if (stats.size !== -1) {
|
|
15459
15587
|
// We don't await this so we can return faster for one-off cases.
|
|
15460
|
-
GitIndexManager.acquire(
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15588
|
+
GitIndexManager.acquire(
|
|
15589
|
+
{ fs, gitdir, cache },
|
|
15590
|
+
async function (index) {
|
|
15591
|
+
index.insert({ filepath, stats, oid: workdirOid });
|
|
15592
|
+
}
|
|
15593
|
+
);
|
|
15465
15594
|
}
|
|
15466
15595
|
}
|
|
15467
15596
|
return workdirOid
|
|
@@ -15706,7 +15835,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
|
|
|
15706
15835
|
async function statusMatrix({
|
|
15707
15836
|
fs: _fs,
|
|
15708
15837
|
dir,
|
|
15709
|
-
gitdir =
|
|
15838
|
+
gitdir = join(dir, '.git'),
|
|
15710
15839
|
ref = 'HEAD',
|
|
15711
15840
|
filepaths = ['.'],
|
|
15712
15841
|
filter,
|
|
@@ -15725,7 +15854,7 @@ async function statusMatrix({
|
|
|
15725
15854
|
dir,
|
|
15726
15855
|
gitdir,
|
|
15727
15856
|
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
15728
|
-
map: async function(filepath, [head, workdir, stage]) {
|
|
15857
|
+
map: async function (filepath, [head, workdir, stage]) {
|
|
15729
15858
|
// Ignore ignored files, but only if they are not already tracked.
|
|
15730
15859
|
if (!head && !stage && workdir) {
|
|
15731
15860
|
if (!shouldIgnore) {
|
|
@@ -15816,7 +15945,7 @@ async function statusMatrix({
|
|
|
15816
15945
|
async function tag({
|
|
15817
15946
|
fs: _fs,
|
|
15818
15947
|
dir,
|
|
15819
|
-
gitdir =
|
|
15948
|
+
gitdir = join(dir, '.git'),
|
|
15820
15949
|
ref,
|
|
15821
15950
|
object,
|
|
15822
15951
|
force = false,
|
|
@@ -15898,7 +16027,7 @@ async function tag({
|
|
|
15898
16027
|
async function updateIndex$1({
|
|
15899
16028
|
fs: _fs,
|
|
15900
16029
|
dir,
|
|
15901
|
-
gitdir =
|
|
16030
|
+
gitdir = join(dir, '.git'),
|
|
15902
16031
|
cache = {},
|
|
15903
16032
|
filepath,
|
|
15904
16033
|
oid,
|
|
@@ -15917,10 +16046,10 @@ async function updateIndex$1({
|
|
|
15917
16046
|
if (remove) {
|
|
15918
16047
|
return await GitIndexManager.acquire(
|
|
15919
16048
|
{ fs, gitdir, cache },
|
|
15920
|
-
async function(index) {
|
|
16049
|
+
async function (index) {
|
|
15921
16050
|
if (!force) {
|
|
15922
16051
|
// Check if the file is still present in the working directory
|
|
15923
|
-
const fileStats = await fs.lstat(
|
|
16052
|
+
const fileStats = await fs.lstat(join(dir, filepath));
|
|
15924
16053
|
|
|
15925
16054
|
if (fileStats) {
|
|
15926
16055
|
if (fileStats.isDirectory()) {
|
|
@@ -15947,7 +16076,7 @@ async function updateIndex$1({
|
|
|
15947
16076
|
let fileStats;
|
|
15948
16077
|
|
|
15949
16078
|
if (!oid) {
|
|
15950
|
-
fileStats = await fs.lstat(
|
|
16079
|
+
fileStats = await fs.lstat(join(dir, filepath));
|
|
15951
16080
|
|
|
15952
16081
|
if (!fileStats) {
|
|
15953
16082
|
throw new NotFoundError(
|
|
@@ -15960,54 +16089,55 @@ async function updateIndex$1({
|
|
|
15960
16089
|
}
|
|
15961
16090
|
}
|
|
15962
16091
|
|
|
15963
|
-
return await GitIndexManager.acquire(
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
16092
|
+
return await GitIndexManager.acquire(
|
|
16093
|
+
{ fs, gitdir, cache },
|
|
16094
|
+
async function (index) {
|
|
16095
|
+
if (!add && !index.has({ filepath })) {
|
|
16096
|
+
// If the index does not contain the filepath yet and `add` is not set, we should throw
|
|
16097
|
+
throw new NotFoundError(
|
|
16098
|
+
`file at "${filepath}" in index and "add" not set`
|
|
16099
|
+
)
|
|
16100
|
+
}
|
|
15972
16101
|
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
16102
|
+
let stats;
|
|
16103
|
+
if (!oid) {
|
|
16104
|
+
stats = fileStats;
|
|
15976
16105
|
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
16106
|
+
// Write the file to the object database
|
|
16107
|
+
const object = stats.isSymbolicLink()
|
|
16108
|
+
? await fs.readlink(join(dir, filepath))
|
|
16109
|
+
: await fs.read(join(dir, filepath));
|
|
15981
16110
|
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16111
|
+
oid = await _writeObject({
|
|
16112
|
+
fs,
|
|
16113
|
+
gitdir,
|
|
16114
|
+
type: 'blob',
|
|
16115
|
+
format: 'content',
|
|
16116
|
+
object,
|
|
16117
|
+
});
|
|
16118
|
+
} else {
|
|
16119
|
+
// By default we use 0 for the stats of the index file
|
|
16120
|
+
stats = {
|
|
16121
|
+
ctime: new Date(0),
|
|
16122
|
+
mtime: new Date(0),
|
|
16123
|
+
dev: 0,
|
|
16124
|
+
ino: 0,
|
|
16125
|
+
mode,
|
|
16126
|
+
uid: 0,
|
|
16127
|
+
gid: 0,
|
|
16128
|
+
size: 0,
|
|
16129
|
+
};
|
|
16130
|
+
}
|
|
16002
16131
|
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16132
|
+
index.insert({
|
|
16133
|
+
filepath,
|
|
16134
|
+
oid,
|
|
16135
|
+
stats,
|
|
16136
|
+
});
|
|
16008
16137
|
|
|
16009
|
-
|
|
16010
|
-
|
|
16138
|
+
return oid
|
|
16139
|
+
}
|
|
16140
|
+
)
|
|
16011
16141
|
} catch (err) {
|
|
16012
16142
|
err.caller = 'git.updateIndex';
|
|
16013
16143
|
throw err
|
|
@@ -16287,7 +16417,7 @@ function version() {
|
|
|
16287
16417
|
async function walk({
|
|
16288
16418
|
fs,
|
|
16289
16419
|
dir,
|
|
16290
|
-
gitdir =
|
|
16420
|
+
gitdir = join(dir, '.git'),
|
|
16291
16421
|
trees,
|
|
16292
16422
|
map,
|
|
16293
16423
|
reduce,
|
|
@@ -16339,7 +16469,7 @@ async function walk({
|
|
|
16339
16469
|
* console.log('oid', oid) // should be 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
|
|
16340
16470
|
*
|
|
16341
16471
|
*/
|
|
16342
|
-
async function writeBlob({ fs, dir, gitdir =
|
|
16472
|
+
async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {
|
|
16343
16473
|
try {
|
|
16344
16474
|
assertParameter('fs', fs);
|
|
16345
16475
|
assertParameter('gitdir', gitdir);
|
|
@@ -16376,7 +16506,7 @@ async function writeBlob({ fs, dir, gitdir = pathBrowserify.join(dir, '.git'), b
|
|
|
16376
16506
|
async function writeCommit({
|
|
16377
16507
|
fs,
|
|
16378
16508
|
dir,
|
|
16379
|
-
gitdir =
|
|
16509
|
+
gitdir = join(dir, '.git'),
|
|
16380
16510
|
commit,
|
|
16381
16511
|
}) {
|
|
16382
16512
|
try {
|
|
@@ -16465,7 +16595,7 @@ async function writeCommit({
|
|
|
16465
16595
|
async function writeObject({
|
|
16466
16596
|
fs: _fs,
|
|
16467
16597
|
dir,
|
|
16468
|
-
gitdir =
|
|
16598
|
+
gitdir = join(dir, '.git'),
|
|
16469
16599
|
type,
|
|
16470
16600
|
object,
|
|
16471
16601
|
format = 'parsed',
|
|
@@ -16547,7 +16677,7 @@ async function writeObject({
|
|
|
16547
16677
|
async function writeRef({
|
|
16548
16678
|
fs: _fs,
|
|
16549
16679
|
dir,
|
|
16550
|
-
gitdir =
|
|
16680
|
+
gitdir = join(dir, '.git'),
|
|
16551
16681
|
ref,
|
|
16552
16682
|
value,
|
|
16553
16683
|
force = false,
|
|
@@ -16561,7 +16691,7 @@ async function writeRef({
|
|
|
16561
16691
|
|
|
16562
16692
|
const fs = new FileSystem(_fs);
|
|
16563
16693
|
|
|
16564
|
-
if (!
|
|
16694
|
+
if (!isValidRef(ref, true)) {
|
|
16565
16695
|
throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
|
|
16566
16696
|
}
|
|
16567
16697
|
|
|
@@ -16657,7 +16787,7 @@ async function _writeTag({ fs, gitdir, tag }) {
|
|
|
16657
16787
|
* console.log('tag', oid)
|
|
16658
16788
|
*
|
|
16659
16789
|
*/
|
|
16660
|
-
async function writeTag({ fs, dir, gitdir =
|
|
16790
|
+
async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {
|
|
16661
16791
|
try {
|
|
16662
16792
|
assertParameter('fs', fs);
|
|
16663
16793
|
assertParameter('gitdir', gitdir);
|
|
@@ -16690,7 +16820,7 @@ async function writeTag({ fs, dir, gitdir = pathBrowserify.join(dir, '.git'), ta
|
|
|
16690
16820
|
* @see TreeEntry
|
|
16691
16821
|
*
|
|
16692
16822
|
*/
|
|
16693
|
-
async function writeTree({ fs, dir, gitdir =
|
|
16823
|
+
async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {
|
|
16694
16824
|
try {
|
|
16695
16825
|
assertParameter('fs', fs);
|
|
16696
16826
|
assertParameter('gitdir', gitdir);
|