isomorphic-git 1.26.1 → 1.26.3
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 +1 -0
- package/browser-tests.json +5 -3
- package/index.cjs +151 -118
- package/index.js +39 -6
- package/index.umd.min.js +2 -2
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/size_report.html +1 -1
package/index.cjs
CHANGED
|
@@ -6,7 +6,6 @@ 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 path = require('path');
|
|
10
9
|
var crc32 = _interopDefault(require('crc-32'));
|
|
11
10
|
var pako = _interopDefault(require('pako'));
|
|
12
11
|
var pify = _interopDefault(require('pify'));
|
|
@@ -1482,6 +1481,40 @@ function compareRefNames(a, b) {
|
|
|
1482
1481
|
return tmp
|
|
1483
1482
|
}
|
|
1484
1483
|
|
|
1484
|
+
const memo = new Map();
|
|
1485
|
+
function normalizePath(path) {
|
|
1486
|
+
let normalizedPath = memo.get(path);
|
|
1487
|
+
if (!normalizedPath) {
|
|
1488
|
+
normalizedPath = normalizePathInternal(path);
|
|
1489
|
+
memo.set(path, normalizedPath);
|
|
1490
|
+
}
|
|
1491
|
+
return normalizedPath
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
function normalizePathInternal(path) {
|
|
1495
|
+
path = path
|
|
1496
|
+
.split('/./')
|
|
1497
|
+
.join('/') // Replace '/./' with '/'
|
|
1498
|
+
.replace(/\/{2,}/g, '/'); // Replace consecutive '/'
|
|
1499
|
+
|
|
1500
|
+
if (path === '/.') return '/' // if path === '/.' return '/'
|
|
1501
|
+
if (path === './') return '.' // if path === './' return '.'
|
|
1502
|
+
|
|
1503
|
+
if (path.startsWith('./')) path = path.slice(2); // Remove leading './'
|
|
1504
|
+
if (path.endsWith('/.')) path = path.slice(0, -2); // Remove trailing '/.'
|
|
1505
|
+
if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1); // Remove trailing '/'
|
|
1506
|
+
|
|
1507
|
+
if (path === '') return '.' // if path === '' return '.'
|
|
1508
|
+
|
|
1509
|
+
return path
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// For some reason path.posix.join is undefined in webpack
|
|
1513
|
+
|
|
1514
|
+
function join(...parts) {
|
|
1515
|
+
return normalizePath(parts.map(normalizePath).join('/'))
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1485
1518
|
// This is straight from parse_unit_factor in config.c of canonical git
|
|
1486
1519
|
const num = val => {
|
|
1487
1520
|
val = val.toLowerCase();
|
|
@@ -1596,7 +1629,7 @@ const getPath = (section, subsection, name) => {
|
|
|
1596
1629
|
.join('.')
|
|
1597
1630
|
};
|
|
1598
1631
|
|
|
1599
|
-
const normalizePath = path => {
|
|
1632
|
+
const normalizePath$1 = path => {
|
|
1600
1633
|
const pathSegments = path.split('.');
|
|
1601
1634
|
const section = pathSegments.shift();
|
|
1602
1635
|
const name = pathSegments.pop();
|
|
@@ -1652,7 +1685,7 @@ class GitConfig {
|
|
|
1652
1685
|
}
|
|
1653
1686
|
|
|
1654
1687
|
async get(path, getall = false) {
|
|
1655
|
-
const normalizedPath = normalizePath(path).path;
|
|
1688
|
+
const normalizedPath = normalizePath$1(path).path;
|
|
1656
1689
|
const allValues = this.parsedConfig
|
|
1657
1690
|
.filter(config => config.path === normalizedPath)
|
|
1658
1691
|
.map(({ section, name, value }) => {
|
|
@@ -1690,7 +1723,7 @@ class GitConfig {
|
|
|
1690
1723
|
name,
|
|
1691
1724
|
path: normalizedPath,
|
|
1692
1725
|
sectionPath,
|
|
1693
|
-
} = normalizePath(path);
|
|
1726
|
+
} = normalizePath$1(path);
|
|
1694
1727
|
const configIndex = findLastIndex(
|
|
1695
1728
|
this.parsedConfig,
|
|
1696
1729
|
config => config.path === normalizedPath
|
|
@@ -1912,7 +1945,7 @@ class GitRefManager {
|
|
|
1912
1945
|
// and .git/refs/remotes/origin/refs/merge-requests
|
|
1913
1946
|
for (const [key, value] of actualRefsToWrite) {
|
|
1914
1947
|
await acquireLock(key, async () =>
|
|
1915
|
-
fs.write(
|
|
1948
|
+
fs.write(join(gitdir, key), `${value.trim()}\n`, 'utf8')
|
|
1916
1949
|
);
|
|
1917
1950
|
}
|
|
1918
1951
|
return { pruned }
|
|
@@ -1925,13 +1958,13 @@ class GitRefManager {
|
|
|
1925
1958
|
throw new InvalidOidError(value)
|
|
1926
1959
|
}
|
|
1927
1960
|
await acquireLock(ref, async () =>
|
|
1928
|
-
fs.write(
|
|
1961
|
+
fs.write(join(gitdir, ref), `${value.trim()}\n`, 'utf8')
|
|
1929
1962
|
);
|
|
1930
1963
|
}
|
|
1931
1964
|
|
|
1932
1965
|
static async writeSymbolicRef({ fs, gitdir, ref, value }) {
|
|
1933
1966
|
await acquireLock(ref, async () =>
|
|
1934
|
-
fs.write(
|
|
1967
|
+
fs.write(join(gitdir, ref), 'ref: ' + `${value.trim()}\n`, 'utf8')
|
|
1935
1968
|
);
|
|
1936
1969
|
}
|
|
1937
1970
|
|
|
@@ -1941,7 +1974,7 @@ class GitRefManager {
|
|
|
1941
1974
|
|
|
1942
1975
|
static async deleteRefs({ fs, gitdir, refs }) {
|
|
1943
1976
|
// Delete regular ref
|
|
1944
|
-
await Promise.all(refs.map(ref => fs.rm(
|
|
1977
|
+
await Promise.all(refs.map(ref => fs.rm(join(gitdir, ref))));
|
|
1945
1978
|
// Delete any packed ref
|
|
1946
1979
|
let text = await acquireLock('packed-refs', async () =>
|
|
1947
1980
|
fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })
|
|
@@ -3070,7 +3103,7 @@ async function readObjectPacked({
|
|
|
3070
3103
|
}) {
|
|
3071
3104
|
// Check to see if it's in a packfile.
|
|
3072
3105
|
// Iterate through all the .idx files
|
|
3073
|
-
let list = await fs.readdir(
|
|
3106
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
3074
3107
|
list = list.filter(x => x.endsWith('.idx'));
|
|
3075
3108
|
for (const filename of list) {
|
|
3076
3109
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -4025,9 +4058,9 @@ class GitWalkerRepo {
|
|
|
4025
4058
|
const tree = GitTree.from(object);
|
|
4026
4059
|
// cache all entries
|
|
4027
4060
|
for (const entry of tree) {
|
|
4028
|
-
map.set(
|
|
4061
|
+
map.set(join(filepath, entry.path), entry);
|
|
4029
4062
|
}
|
|
4030
|
-
return tree.entries().map(entry =>
|
|
4063
|
+
return tree.entries().map(entry => join(filepath, entry.path))
|
|
4031
4064
|
}
|
|
4032
4065
|
|
|
4033
4066
|
async type(entry) {
|
|
@@ -4138,9 +4171,9 @@ class GitWalkerFs {
|
|
|
4138
4171
|
async readdir(entry) {
|
|
4139
4172
|
const filepath = entry._fullpath;
|
|
4140
4173
|
const { fs, dir } = this;
|
|
4141
|
-
const names = await fs.readdir(
|
|
4174
|
+
const names = await fs.readdir(join(dir, filepath));
|
|
4142
4175
|
if (names === null) return null
|
|
4143
|
-
return names.map(name =>
|
|
4176
|
+
return names.map(name => join(filepath, name))
|
|
4144
4177
|
}
|
|
4145
4178
|
|
|
4146
4179
|
async type(entry) {
|
|
@@ -4447,7 +4480,7 @@ async function rmRecursive(fs, filepath) {
|
|
|
4447
4480
|
} else if (entries.length) {
|
|
4448
4481
|
await Promise.all(
|
|
4449
4482
|
entries.map(entry => {
|
|
4450
|
-
const subpath =
|
|
4483
|
+
const subpath = join(filepath, entry);
|
|
4451
4484
|
return fs.lstat(subpath).then(stat => {
|
|
4452
4485
|
if (!stat) return
|
|
4453
4486
|
return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath)
|
|
@@ -4792,7 +4825,7 @@ async function modified(entry, base) {
|
|
|
4792
4825
|
async function abortMerge({
|
|
4793
4826
|
fs: _fs,
|
|
4794
4827
|
dir,
|
|
4795
|
-
gitdir =
|
|
4828
|
+
gitdir = join(dir, '.git'),
|
|
4796
4829
|
commit = 'HEAD',
|
|
4797
4830
|
cache = {},
|
|
4798
4831
|
}) {
|
|
@@ -4871,21 +4904,21 @@ async function abortMerge({
|
|
|
4871
4904
|
// I'm putting this in a Manager because I reckon it could benefit
|
|
4872
4905
|
// from a LOT of caching.
|
|
4873
4906
|
class GitIgnoreManager {
|
|
4874
|
-
static async isIgnored({ fs, dir, gitdir =
|
|
4907
|
+
static async isIgnored({ fs, dir, gitdir = join(dir, '.git'), filepath }) {
|
|
4875
4908
|
// ALWAYS ignore ".git" folders.
|
|
4876
4909
|
if (basename(filepath) === '.git') return true
|
|
4877
4910
|
// '.' is not a valid gitignore entry, so '.' is never ignored
|
|
4878
4911
|
if (filepath === '.') return false
|
|
4879
4912
|
// Check and load exclusion rules from project exclude file (.git/info/exclude)
|
|
4880
4913
|
let excludes = '';
|
|
4881
|
-
const excludesFile =
|
|
4914
|
+
const excludesFile = join(gitdir, 'info', 'exclude');
|
|
4882
4915
|
if (await fs.exists(excludesFile)) {
|
|
4883
4916
|
excludes = await fs.read(excludesFile, 'utf8');
|
|
4884
4917
|
}
|
|
4885
4918
|
// Find all the .gitignore files that could affect this file
|
|
4886
4919
|
const pairs = [
|
|
4887
4920
|
{
|
|
4888
|
-
gitignore:
|
|
4921
|
+
gitignore: join(dir, '.gitignore'),
|
|
4889
4922
|
filepath,
|
|
4890
4923
|
},
|
|
4891
4924
|
];
|
|
@@ -4894,7 +4927,7 @@ class GitIgnoreManager {
|
|
|
4894
4927
|
const folder = pieces.slice(0, i).join('/');
|
|
4895
4928
|
const file = pieces.slice(i).join('/');
|
|
4896
4929
|
pairs.push({
|
|
4897
|
-
gitignore:
|
|
4930
|
+
gitignore: join(dir, folder, '.gitignore'),
|
|
4898
4931
|
filepath: file,
|
|
4899
4932
|
});
|
|
4900
4933
|
}
|
|
@@ -5023,7 +5056,7 @@ function posixifyPathBuffer(buffer) {
|
|
|
5023
5056
|
async function add({
|
|
5024
5057
|
fs: _fs,
|
|
5025
5058
|
dir,
|
|
5026
|
-
gitdir =
|
|
5059
|
+
gitdir = join(dir, '.git'),
|
|
5027
5060
|
filepath,
|
|
5028
5061
|
cache = {},
|
|
5029
5062
|
force = false,
|
|
@@ -5074,18 +5107,18 @@ async function addToIndex({
|
|
|
5074
5107
|
});
|
|
5075
5108
|
if (ignored) return
|
|
5076
5109
|
}
|
|
5077
|
-
const stats = await fs.lstat(
|
|
5110
|
+
const stats = await fs.lstat(join(dir, currentFilepath));
|
|
5078
5111
|
if (!stats) throw new NotFoundError(currentFilepath)
|
|
5079
5112
|
|
|
5080
5113
|
if (stats.isDirectory()) {
|
|
5081
|
-
const children = await fs.readdir(
|
|
5114
|
+
const children = await fs.readdir(join(dir, currentFilepath));
|
|
5082
5115
|
if (parallel) {
|
|
5083
5116
|
const promises = children.map(child =>
|
|
5084
5117
|
addToIndex({
|
|
5085
5118
|
dir,
|
|
5086
5119
|
gitdir,
|
|
5087
5120
|
fs,
|
|
5088
|
-
filepath: [
|
|
5121
|
+
filepath: [join(currentFilepath, child)],
|
|
5089
5122
|
index,
|
|
5090
5123
|
force,
|
|
5091
5124
|
parallel,
|
|
@@ -5098,7 +5131,7 @@ async function addToIndex({
|
|
|
5098
5131
|
dir,
|
|
5099
5132
|
gitdir,
|
|
5100
5133
|
fs,
|
|
5101
|
-
filepath: [
|
|
5134
|
+
filepath: [join(currentFilepath, child)],
|
|
5102
5135
|
index,
|
|
5103
5136
|
force,
|
|
5104
5137
|
parallel,
|
|
@@ -5109,8 +5142,8 @@ async function addToIndex({
|
|
|
5109
5142
|
const config = await GitConfigManager.get({ fs, gitdir });
|
|
5110
5143
|
const autocrlf = await config.get('core.autocrlf');
|
|
5111
5144
|
const object = stats.isSymbolicLink()
|
|
5112
|
-
? await fs.readlink(
|
|
5113
|
-
: await fs.read(
|
|
5145
|
+
? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
|
|
5146
|
+
: await fs.read(join(dir, currentFilepath), { autocrlf });
|
|
5114
5147
|
if (object === null) throw new NotFoundError(currentFilepath)
|
|
5115
5148
|
const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
|
|
5116
5149
|
index.insert({ filepath: currentFilepath, stats, oid });
|
|
@@ -5615,7 +5648,7 @@ async function addNote({
|
|
|
5615
5648
|
fs: _fs,
|
|
5616
5649
|
onSign,
|
|
5617
5650
|
dir,
|
|
5618
|
-
gitdir =
|
|
5651
|
+
gitdir = join(dir, '.git'),
|
|
5619
5652
|
ref = 'refs/notes/commits',
|
|
5620
5653
|
oid,
|
|
5621
5654
|
note,
|
|
@@ -5730,7 +5763,7 @@ async function _addRemote({ fs, gitdir, remote, url, force }) {
|
|
|
5730
5763
|
async function addRemote({
|
|
5731
5764
|
fs,
|
|
5732
5765
|
dir,
|
|
5733
|
-
gitdir =
|
|
5766
|
+
gitdir = join(dir, '.git'),
|
|
5734
5767
|
remote,
|
|
5735
5768
|
url,
|
|
5736
5769
|
force = false,
|
|
@@ -5881,7 +5914,7 @@ async function annotatedTag({
|
|
|
5881
5914
|
fs: _fs,
|
|
5882
5915
|
onSign,
|
|
5883
5916
|
dir,
|
|
5884
|
-
gitdir =
|
|
5917
|
+
gitdir = join(dir, '.git'),
|
|
5885
5918
|
ref,
|
|
5886
5919
|
tagger: _tagger,
|
|
5887
5920
|
message = ref,
|
|
@@ -6012,7 +6045,7 @@ async function _branch({
|
|
|
6012
6045
|
async function branch({
|
|
6013
6046
|
fs,
|
|
6014
6047
|
dir,
|
|
6015
|
-
gitdir =
|
|
6048
|
+
gitdir = join(dir, '.git'),
|
|
6016
6049
|
ref,
|
|
6017
6050
|
object,
|
|
6018
6051
|
checkout = false,
|
|
@@ -6700,7 +6733,7 @@ async function checkout({
|
|
|
6700
6733
|
onProgress,
|
|
6701
6734
|
onPostCheckout,
|
|
6702
6735
|
dir,
|
|
6703
|
-
gitdir =
|
|
6736
|
+
gitdir = join(dir, '.git'),
|
|
6704
6737
|
remote = 'origin',
|
|
6705
6738
|
ref: _ref,
|
|
6706
6739
|
filepaths,
|
|
@@ -7305,7 +7338,7 @@ let lock$2 = null;
|
|
|
7305
7338
|
class GitShallowManager {
|
|
7306
7339
|
static async read({ fs, gitdir }) {
|
|
7307
7340
|
if (lock$2 === null) lock$2 = new AsyncLock();
|
|
7308
|
-
const filepath =
|
|
7341
|
+
const filepath = join(gitdir, 'shallow');
|
|
7309
7342
|
const oids = new Set();
|
|
7310
7343
|
await lock$2.acquire(filepath, async function() {
|
|
7311
7344
|
const text = await fs.read(filepath, { encoding: 'utf8' });
|
|
@@ -7321,7 +7354,7 @@ class GitShallowManager {
|
|
|
7321
7354
|
|
|
7322
7355
|
static async write({ fs, gitdir, oids }) {
|
|
7323
7356
|
if (lock$2 === null) lock$2 = new AsyncLock();
|
|
7324
|
-
const filepath =
|
|
7357
|
+
const filepath = join(gitdir, 'shallow');
|
|
7325
7358
|
if (oids.size > 0) {
|
|
7326
7359
|
const text = [...oids].join('\n') + '\n';
|
|
7327
7360
|
await lock$2.acquire(filepath, async function() {
|
|
@@ -7352,7 +7385,7 @@ async function hasObjectPacked({
|
|
|
7352
7385
|
}) {
|
|
7353
7386
|
// Check to see if it's in a packfile.
|
|
7354
7387
|
// Iterate through all the .idx files
|
|
7355
|
-
let list = await fs.readdir(
|
|
7388
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
7356
7389
|
list = list.filter(x => x.endsWith('.idx'));
|
|
7357
7390
|
for (const filename of list) {
|
|
7358
7391
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -7418,8 +7451,8 @@ function filterCapabilities(server, client) {
|
|
|
7418
7451
|
|
|
7419
7452
|
const pkg = {
|
|
7420
7453
|
name: 'isomorphic-git',
|
|
7421
|
-
version: '1.26.
|
|
7422
|
-
agent: 'git/isomorphic-git@1.26.
|
|
7454
|
+
version: '1.26.3',
|
|
7455
|
+
agent: 'git/isomorphic-git@1.26.3',
|
|
7423
7456
|
};
|
|
7424
7457
|
|
|
7425
7458
|
class FIFO {
|
|
@@ -8085,7 +8118,7 @@ async function _fetch({
|
|
|
8085
8118
|
// 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.
|
|
8086
8119
|
if (packfileSha !== '' && !emptyPackfile(packfile)) {
|
|
8087
8120
|
res.packfile = `objects/pack/pack-${packfileSha}.pack`;
|
|
8088
|
-
const fullpath =
|
|
8121
|
+
const fullpath = join(gitdir, res.packfile);
|
|
8089
8122
|
await fs.write(fullpath, packfile);
|
|
8090
8123
|
const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
|
|
8091
8124
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -8115,7 +8148,7 @@ async function _init({
|
|
|
8115
8148
|
fs,
|
|
8116
8149
|
bare = false,
|
|
8117
8150
|
dir,
|
|
8118
|
-
gitdir = bare ? dir :
|
|
8151
|
+
gitdir = bare ? dir : join(dir, '.git'),
|
|
8119
8152
|
defaultBranch = 'master',
|
|
8120
8153
|
}) {
|
|
8121
8154
|
// Don't overwrite an existing config
|
|
@@ -8313,7 +8346,7 @@ async function clone({
|
|
|
8313
8346
|
onAuthFailure,
|
|
8314
8347
|
onPostCheckout,
|
|
8315
8348
|
dir,
|
|
8316
|
-
gitdir =
|
|
8349
|
+
gitdir = join(dir, '.git'),
|
|
8317
8350
|
url,
|
|
8318
8351
|
corsProxy = undefined,
|
|
8319
8352
|
ref = undefined,
|
|
@@ -8416,7 +8449,7 @@ async function commit({
|
|
|
8416
8449
|
fs: _fs,
|
|
8417
8450
|
onSign,
|
|
8418
8451
|
dir,
|
|
8419
|
-
gitdir =
|
|
8452
|
+
gitdir = join(dir, '.git'),
|
|
8420
8453
|
message,
|
|
8421
8454
|
author: _author,
|
|
8422
8455
|
committer: _committer,
|
|
@@ -8495,7 +8528,7 @@ async function commit({
|
|
|
8495
8528
|
async function currentBranch({
|
|
8496
8529
|
fs,
|
|
8497
8530
|
dir,
|
|
8498
|
-
gitdir =
|
|
8531
|
+
gitdir = join(dir, '.git'),
|
|
8499
8532
|
fullname = false,
|
|
8500
8533
|
test = false,
|
|
8501
8534
|
}) {
|
|
@@ -8566,7 +8599,7 @@ async function _deleteBranch({ fs, gitdir, ref }) {
|
|
|
8566
8599
|
async function deleteBranch({
|
|
8567
8600
|
fs,
|
|
8568
8601
|
dir,
|
|
8569
|
-
gitdir =
|
|
8602
|
+
gitdir = join(dir, '.git'),
|
|
8570
8603
|
ref,
|
|
8571
8604
|
}) {
|
|
8572
8605
|
try {
|
|
@@ -8601,7 +8634,7 @@ async function deleteBranch({
|
|
|
8601
8634
|
* console.log('done')
|
|
8602
8635
|
*
|
|
8603
8636
|
*/
|
|
8604
|
-
async function deleteRef({ fs, dir, gitdir =
|
|
8637
|
+
async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
8605
8638
|
try {
|
|
8606
8639
|
assertParameter('fs', fs);
|
|
8607
8640
|
assertParameter('ref', ref);
|
|
@@ -8649,7 +8682,7 @@ async function _deleteRemote({ fs, gitdir, remote }) {
|
|
|
8649
8682
|
async function deleteRemote({
|
|
8650
8683
|
fs,
|
|
8651
8684
|
dir,
|
|
8652
|
-
gitdir =
|
|
8685
|
+
gitdir = join(dir, '.git'),
|
|
8653
8686
|
remote,
|
|
8654
8687
|
}) {
|
|
8655
8688
|
try {
|
|
@@ -8706,7 +8739,7 @@ async function _deleteTag({ fs, gitdir, ref }) {
|
|
|
8706
8739
|
* console.log('done')
|
|
8707
8740
|
*
|
|
8708
8741
|
*/
|
|
8709
|
-
async function deleteTag({ fs, dir, gitdir =
|
|
8742
|
+
async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
8710
8743
|
try {
|
|
8711
8744
|
assertParameter('fs', fs);
|
|
8712
8745
|
assertParameter('ref', ref);
|
|
@@ -8738,7 +8771,7 @@ async function expandOidPacked({
|
|
|
8738
8771
|
}) {
|
|
8739
8772
|
// Iterate through all the .pack files
|
|
8740
8773
|
const results = [];
|
|
8741
|
-
let list = await fs.readdir(
|
|
8774
|
+
let list = await fs.readdir(join(gitdir, 'objects/pack'));
|
|
8742
8775
|
list = list.filter(x => x.endsWith('.idx'));
|
|
8743
8776
|
for (const filename of list) {
|
|
8744
8777
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -8808,7 +8841,7 @@ async function _expandOid({ fs, cache, gitdir, oid: short }) {
|
|
|
8808
8841
|
async function expandOid({
|
|
8809
8842
|
fs,
|
|
8810
8843
|
dir,
|
|
8811
|
-
gitdir =
|
|
8844
|
+
gitdir = join(dir, '.git'),
|
|
8812
8845
|
oid,
|
|
8813
8846
|
cache = {},
|
|
8814
8847
|
}) {
|
|
@@ -8846,7 +8879,7 @@ async function expandOid({
|
|
|
8846
8879
|
* console.log(fullRef)
|
|
8847
8880
|
*
|
|
8848
8881
|
*/
|
|
8849
|
-
async function expandRef({ fs, dir, gitdir =
|
|
8882
|
+
async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
|
|
8850
8883
|
try {
|
|
8851
8884
|
assertParameter('fs', fs);
|
|
8852
8885
|
assertParameter('gitdir', gitdir);
|
|
@@ -8986,7 +9019,7 @@ async function mergeTree({
|
|
|
8986
9019
|
fs,
|
|
8987
9020
|
cache,
|
|
8988
9021
|
dir,
|
|
8989
|
-
gitdir =
|
|
9022
|
+
gitdir = join(dir, '.git'),
|
|
8990
9023
|
index,
|
|
8991
9024
|
ourOid,
|
|
8992
9025
|
baseOid,
|
|
@@ -9643,7 +9676,7 @@ async function fastForward({
|
|
|
9643
9676
|
onAuthSuccess,
|
|
9644
9677
|
onAuthFailure,
|
|
9645
9678
|
dir,
|
|
9646
|
-
gitdir =
|
|
9679
|
+
gitdir = join(dir, '.git'),
|
|
9647
9680
|
ref,
|
|
9648
9681
|
url,
|
|
9649
9682
|
remote,
|
|
@@ -9762,7 +9795,7 @@ async function fetch({
|
|
|
9762
9795
|
onAuthSuccess,
|
|
9763
9796
|
onAuthFailure,
|
|
9764
9797
|
dir,
|
|
9765
|
-
gitdir =
|
|
9798
|
+
gitdir = join(dir, '.git'),
|
|
9766
9799
|
ref,
|
|
9767
9800
|
remote,
|
|
9768
9801
|
remoteRef,
|
|
@@ -9831,7 +9864,7 @@ async function fetch({
|
|
|
9831
9864
|
async function findMergeBase({
|
|
9832
9865
|
fs,
|
|
9833
9866
|
dir,
|
|
9834
|
-
gitdir =
|
|
9867
|
+
gitdir = join(dir, '.git'),
|
|
9835
9868
|
oids,
|
|
9836
9869
|
cache = {},
|
|
9837
9870
|
}) {
|
|
@@ -9866,7 +9899,7 @@ async function findMergeBase({
|
|
|
9866
9899
|
* @returns {Promise<string>} Resolves successfully with a root git directory path
|
|
9867
9900
|
*/
|
|
9868
9901
|
async function _findRoot({ fs, filepath }) {
|
|
9869
|
-
if (await fs.exists(
|
|
9902
|
+
if (await fs.exists(join(filepath, '.git'))) {
|
|
9870
9903
|
return filepath
|
|
9871
9904
|
} else {
|
|
9872
9905
|
const parent = dirname(filepath);
|
|
@@ -9938,16 +9971,16 @@ async function findRoot({ fs, filepath }) {
|
|
|
9938
9971
|
* console.log(value)
|
|
9939
9972
|
*
|
|
9940
9973
|
*/
|
|
9941
|
-
async function getConfig({ fs, dir, gitdir =
|
|
9974
|
+
async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {
|
|
9942
9975
|
try {
|
|
9943
9976
|
assertParameter('fs', fs);
|
|
9944
9977
|
assertParameter('gitdir', gitdir);
|
|
9945
|
-
assertParameter('path', path
|
|
9978
|
+
assertParameter('path', path);
|
|
9946
9979
|
|
|
9947
9980
|
return await _getConfig({
|
|
9948
9981
|
fs: new FileSystem(fs),
|
|
9949
9982
|
gitdir,
|
|
9950
|
-
path
|
|
9983
|
+
path,
|
|
9951
9984
|
})
|
|
9952
9985
|
} catch (err) {
|
|
9953
9986
|
err.caller = 'git.getConfig';
|
|
@@ -9992,18 +10025,18 @@ async function _getConfigAll({ fs, gitdir, path }) {
|
|
|
9992
10025
|
async function getConfigAll({
|
|
9993
10026
|
fs,
|
|
9994
10027
|
dir,
|
|
9995
|
-
gitdir =
|
|
9996
|
-
path
|
|
10028
|
+
gitdir = join(dir, '.git'),
|
|
10029
|
+
path,
|
|
9997
10030
|
}) {
|
|
9998
10031
|
try {
|
|
9999
10032
|
assertParameter('fs', fs);
|
|
10000
10033
|
assertParameter('gitdir', gitdir);
|
|
10001
|
-
assertParameter('path', path
|
|
10034
|
+
assertParameter('path', path);
|
|
10002
10035
|
|
|
10003
10036
|
return await _getConfigAll({
|
|
10004
10037
|
fs: new FileSystem(fs),
|
|
10005
10038
|
gitdir,
|
|
10006
|
-
path
|
|
10039
|
+
path,
|
|
10007
10040
|
})
|
|
10008
10041
|
} catch (err) {
|
|
10009
10042
|
err.caller = 'git.getConfigAll';
|
|
@@ -10357,7 +10390,7 @@ async function _indexPack({
|
|
|
10357
10390
|
filepath,
|
|
10358
10391
|
}) {
|
|
10359
10392
|
try {
|
|
10360
|
-
filepath =
|
|
10393
|
+
filepath = join(dir, filepath);
|
|
10361
10394
|
const pack = await fs.read(filepath);
|
|
10362
10395
|
const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
|
|
10363
10396
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -10410,7 +10443,7 @@ async function indexPack({
|
|
|
10410
10443
|
fs,
|
|
10411
10444
|
onProgress,
|
|
10412
10445
|
dir,
|
|
10413
|
-
gitdir =
|
|
10446
|
+
gitdir = join(dir, '.git'),
|
|
10414
10447
|
filepath,
|
|
10415
10448
|
cache = {},
|
|
10416
10449
|
}) {
|
|
@@ -10456,7 +10489,7 @@ async function init({
|
|
|
10456
10489
|
fs,
|
|
10457
10490
|
bare = false,
|
|
10458
10491
|
dir,
|
|
10459
|
-
gitdir = bare ? dir :
|
|
10492
|
+
gitdir = bare ? dir : join(dir, '.git'),
|
|
10460
10493
|
defaultBranch = 'master',
|
|
10461
10494
|
}) {
|
|
10462
10495
|
try {
|
|
@@ -10577,7 +10610,7 @@ async function _isDescendent({
|
|
|
10577
10610
|
async function isDescendent({
|
|
10578
10611
|
fs,
|
|
10579
10612
|
dir,
|
|
10580
|
-
gitdir =
|
|
10613
|
+
gitdir = join(dir, '.git'),
|
|
10581
10614
|
oid,
|
|
10582
10615
|
ancestor,
|
|
10583
10616
|
depth = -1,
|
|
@@ -10623,7 +10656,7 @@ async function isDescendent({
|
|
|
10623
10656
|
async function isIgnored({
|
|
10624
10657
|
fs,
|
|
10625
10658
|
dir,
|
|
10626
|
-
gitdir =
|
|
10659
|
+
gitdir = join(dir, '.git'),
|
|
10627
10660
|
filepath,
|
|
10628
10661
|
}) {
|
|
10629
10662
|
try {
|
|
@@ -10676,7 +10709,7 @@ async function isIgnored({
|
|
|
10676
10709
|
async function listBranches({
|
|
10677
10710
|
fs,
|
|
10678
10711
|
dir,
|
|
10679
|
-
gitdir =
|
|
10712
|
+
gitdir = join(dir, '.git'),
|
|
10680
10713
|
remote,
|
|
10681
10714
|
}) {
|
|
10682
10715
|
try {
|
|
@@ -10745,10 +10778,10 @@ async function accumulateFilesFromOid({
|
|
|
10745
10778
|
gitdir,
|
|
10746
10779
|
oid: entry.oid,
|
|
10747
10780
|
filenames,
|
|
10748
|
-
prefix:
|
|
10781
|
+
prefix: join(prefix, entry.path),
|
|
10749
10782
|
});
|
|
10750
10783
|
} else {
|
|
10751
|
-
filenames.push(
|
|
10784
|
+
filenames.push(join(prefix, entry.path));
|
|
10752
10785
|
}
|
|
10753
10786
|
}
|
|
10754
10787
|
}
|
|
@@ -10782,7 +10815,7 @@ async function accumulateFilesFromOid({
|
|
|
10782
10815
|
async function listFiles({
|
|
10783
10816
|
fs,
|
|
10784
10817
|
dir,
|
|
10785
|
-
gitdir =
|
|
10818
|
+
gitdir = join(dir, '.git'),
|
|
10786
10819
|
ref,
|
|
10787
10820
|
cache = {},
|
|
10788
10821
|
}) {
|
|
@@ -10861,7 +10894,7 @@ async function _listNotes({ fs, cache, gitdir, ref }) {
|
|
|
10861
10894
|
async function listNotes({
|
|
10862
10895
|
fs,
|
|
10863
10896
|
dir,
|
|
10864
|
-
gitdir =
|
|
10897
|
+
gitdir = join(dir, '.git'),
|
|
10865
10898
|
ref = 'refs/notes/commits',
|
|
10866
10899
|
cache = {},
|
|
10867
10900
|
}) {
|
|
@@ -10920,7 +10953,7 @@ async function _listRemotes({ fs, gitdir }) {
|
|
|
10920
10953
|
* console.log(remotes)
|
|
10921
10954
|
*
|
|
10922
10955
|
*/
|
|
10923
|
-
async function listRemotes({ fs, dir, gitdir =
|
|
10956
|
+
async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
10924
10957
|
try {
|
|
10925
10958
|
assertParameter('fs', fs);
|
|
10926
10959
|
assertParameter('gitdir', gitdir);
|
|
@@ -11164,7 +11197,7 @@ async function listServerRefs({
|
|
|
11164
11197
|
* console.log(tags)
|
|
11165
11198
|
*
|
|
11166
11199
|
*/
|
|
11167
|
-
async function listTags({ fs, dir, gitdir =
|
|
11200
|
+
async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {
|
|
11168
11201
|
try {
|
|
11169
11202
|
assertParameter('fs', fs);
|
|
11170
11203
|
assertParameter('gitdir', gitdir);
|
|
@@ -11265,7 +11298,7 @@ async function _resolveFileId({
|
|
|
11265
11298
|
const walks = tree.entries().map(function(entry) {
|
|
11266
11299
|
let result;
|
|
11267
11300
|
if (entry.oid === fileId) {
|
|
11268
|
-
result =
|
|
11301
|
+
result = join(parentPath, entry.path);
|
|
11269
11302
|
filepaths.push(result);
|
|
11270
11303
|
} else if (entry.type === 'tree') {
|
|
11271
11304
|
result = _readObject({
|
|
@@ -11282,7 +11315,7 @@ async function _resolveFileId({
|
|
|
11282
11315
|
fileId,
|
|
11283
11316
|
oid,
|
|
11284
11317
|
filepaths,
|
|
11285
|
-
parentPath:
|
|
11318
|
+
parentPath: join(parentPath, entry.path),
|
|
11286
11319
|
})
|
|
11287
11320
|
});
|
|
11288
11321
|
}
|
|
@@ -11492,7 +11525,7 @@ async function _log({
|
|
|
11492
11525
|
async function log({
|
|
11493
11526
|
fs,
|
|
11494
11527
|
dir,
|
|
11495
|
-
gitdir =
|
|
11528
|
+
gitdir = join(dir, '.git'),
|
|
11496
11529
|
filepath,
|
|
11497
11530
|
ref = 'HEAD',
|
|
11498
11531
|
depth,
|
|
@@ -11640,7 +11673,7 @@ async function merge({
|
|
|
11640
11673
|
fs: _fs,
|
|
11641
11674
|
onSign,
|
|
11642
11675
|
dir,
|
|
11643
|
-
gitdir =
|
|
11676
|
+
gitdir = join(dir, '.git'),
|
|
11644
11677
|
ours,
|
|
11645
11678
|
theirs,
|
|
11646
11679
|
fastForward = true,
|
|
@@ -11726,7 +11759,7 @@ async function _pack({
|
|
|
11726
11759
|
fs,
|
|
11727
11760
|
cache,
|
|
11728
11761
|
dir,
|
|
11729
|
-
gitdir =
|
|
11762
|
+
gitdir = join(dir, '.git'),
|
|
11730
11763
|
oids,
|
|
11731
11764
|
}) {
|
|
11732
11765
|
const hash = new Hash();
|
|
@@ -11802,7 +11835,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
|
|
|
11802
11835
|
const packfileSha = packfile.slice(-20).toString('hex');
|
|
11803
11836
|
const filename = `pack-${packfileSha}.pack`;
|
|
11804
11837
|
if (write) {
|
|
11805
|
-
await fs.write(
|
|
11838
|
+
await fs.write(join(gitdir, `objects/pack/${filename}`), packfile);
|
|
11806
11839
|
return { filename }
|
|
11807
11840
|
}
|
|
11808
11841
|
return {
|
|
@@ -11847,7 +11880,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
|
|
|
11847
11880
|
async function packObjects({
|
|
11848
11881
|
fs,
|
|
11849
11882
|
dir,
|
|
11850
|
-
gitdir =
|
|
11883
|
+
gitdir = join(dir, '.git'),
|
|
11851
11884
|
oids,
|
|
11852
11885
|
write = false,
|
|
11853
11886
|
cache = {},
|
|
@@ -11931,7 +11964,7 @@ async function pull({
|
|
|
11931
11964
|
onAuthSuccess,
|
|
11932
11965
|
onAuthFailure,
|
|
11933
11966
|
dir,
|
|
11934
|
-
gitdir =
|
|
11967
|
+
gitdir = join(dir, '.git'),
|
|
11935
11968
|
ref,
|
|
11936
11969
|
url,
|
|
11937
11970
|
remote,
|
|
@@ -12011,7 +12044,7 @@ async function listCommitsAndTags({
|
|
|
12011
12044
|
fs,
|
|
12012
12045
|
cache,
|
|
12013
12046
|
dir,
|
|
12014
|
-
gitdir =
|
|
12047
|
+
gitdir = join(dir, '.git'),
|
|
12015
12048
|
start,
|
|
12016
12049
|
finish,
|
|
12017
12050
|
}) {
|
|
@@ -12074,7 +12107,7 @@ async function listObjects({
|
|
|
12074
12107
|
fs,
|
|
12075
12108
|
cache,
|
|
12076
12109
|
dir,
|
|
12077
|
-
gitdir =
|
|
12110
|
+
gitdir = join(dir, '.git'),
|
|
12078
12111
|
oids,
|
|
12079
12112
|
}) {
|
|
12080
12113
|
const visited = new Set();
|
|
@@ -12516,7 +12549,7 @@ async function push({
|
|
|
12516
12549
|
onAuthFailure,
|
|
12517
12550
|
onPrePush,
|
|
12518
12551
|
dir,
|
|
12519
|
-
gitdir =
|
|
12552
|
+
gitdir = join(dir, '.git'),
|
|
12520
12553
|
ref,
|
|
12521
12554
|
remoteRef,
|
|
12522
12555
|
remote = 'origin',
|
|
@@ -12651,7 +12684,7 @@ async function _readBlob({
|
|
|
12651
12684
|
async function readBlob({
|
|
12652
12685
|
fs,
|
|
12653
12686
|
dir,
|
|
12654
|
-
gitdir =
|
|
12687
|
+
gitdir = join(dir, '.git'),
|
|
12655
12688
|
oid,
|
|
12656
12689
|
filepath,
|
|
12657
12690
|
cache = {},
|
|
@@ -12701,7 +12734,7 @@ async function readBlob({
|
|
|
12701
12734
|
async function readCommit({
|
|
12702
12735
|
fs,
|
|
12703
12736
|
dir,
|
|
12704
|
-
gitdir =
|
|
12737
|
+
gitdir = join(dir, '.git'),
|
|
12705
12738
|
oid,
|
|
12706
12739
|
cache = {},
|
|
12707
12740
|
}) {
|
|
@@ -12775,7 +12808,7 @@ async function _readNote({
|
|
|
12775
12808
|
async function readNote({
|
|
12776
12809
|
fs,
|
|
12777
12810
|
dir,
|
|
12778
|
-
gitdir =
|
|
12811
|
+
gitdir = join(dir, '.git'),
|
|
12779
12812
|
ref = 'refs/notes/commits',
|
|
12780
12813
|
oid,
|
|
12781
12814
|
cache = {},
|
|
@@ -12992,7 +13025,7 @@ async function readNote({
|
|
|
12992
13025
|
async function readObject({
|
|
12993
13026
|
fs: _fs,
|
|
12994
13027
|
dir,
|
|
12995
|
-
gitdir =
|
|
13028
|
+
gitdir = join(dir, '.git'),
|
|
12996
13029
|
oid,
|
|
12997
13030
|
format = 'parsed',
|
|
12998
13031
|
filepath = undefined,
|
|
@@ -13129,7 +13162,7 @@ async function _readTag({ fs, cache, gitdir, oid }) {
|
|
|
13129
13162
|
async function readTag({
|
|
13130
13163
|
fs,
|
|
13131
13164
|
dir,
|
|
13132
|
-
gitdir =
|
|
13165
|
+
gitdir = join(dir, '.git'),
|
|
13133
13166
|
oid,
|
|
13134
13167
|
cache = {},
|
|
13135
13168
|
}) {
|
|
@@ -13179,7 +13212,7 @@ async function readTag({
|
|
|
13179
13212
|
async function readTree({
|
|
13180
13213
|
fs,
|
|
13181
13214
|
dir,
|
|
13182
|
-
gitdir =
|
|
13215
|
+
gitdir = join(dir, '.git'),
|
|
13183
13216
|
oid,
|
|
13184
13217
|
filepath = undefined,
|
|
13185
13218
|
cache = {},
|
|
@@ -13226,7 +13259,7 @@ async function readTree({
|
|
|
13226
13259
|
async function remove({
|
|
13227
13260
|
fs: _fs,
|
|
13228
13261
|
dir,
|
|
13229
|
-
gitdir =
|
|
13262
|
+
gitdir = join(dir, '.git'),
|
|
13230
13263
|
filepath,
|
|
13231
13264
|
cache = {},
|
|
13232
13265
|
}) {
|
|
@@ -13362,7 +13395,7 @@ async function removeNote({
|
|
|
13362
13395
|
fs: _fs,
|
|
13363
13396
|
onSign,
|
|
13364
13397
|
dir,
|
|
13365
|
-
gitdir =
|
|
13398
|
+
gitdir = join(dir, '.git'),
|
|
13366
13399
|
ref = 'refs/notes/commits',
|
|
13367
13400
|
oid,
|
|
13368
13401
|
author: _author,
|
|
@@ -13494,7 +13527,7 @@ async function _renameBranch({
|
|
|
13494
13527
|
async function renameBranch({
|
|
13495
13528
|
fs,
|
|
13496
13529
|
dir,
|
|
13497
|
-
gitdir =
|
|
13530
|
+
gitdir = join(dir, '.git'),
|
|
13498
13531
|
ref,
|
|
13499
13532
|
oldref,
|
|
13500
13533
|
checkout = false,
|
|
@@ -13546,7 +13579,7 @@ async function hashObject$1({ gitdir, type, object }) {
|
|
|
13546
13579
|
async function resetIndex({
|
|
13547
13580
|
fs: _fs,
|
|
13548
13581
|
dir,
|
|
13549
|
-
gitdir =
|
|
13582
|
+
gitdir = join(dir, '.git'),
|
|
13550
13583
|
filepath,
|
|
13551
13584
|
ref,
|
|
13552
13585
|
cache = {},
|
|
@@ -13601,7 +13634,7 @@ async function resetIndex({
|
|
|
13601
13634
|
size: 0,
|
|
13602
13635
|
};
|
|
13603
13636
|
// If the file exists in the workdir...
|
|
13604
|
-
const object = dir && (await fs.read(
|
|
13637
|
+
const object = dir && (await fs.read(join(dir, filepath)));
|
|
13605
13638
|
if (object) {
|
|
13606
13639
|
// ... and has the same hash as the desired state...
|
|
13607
13640
|
workdirOid = await hashObject$1({
|
|
@@ -13611,7 +13644,7 @@ async function resetIndex({
|
|
|
13611
13644
|
});
|
|
13612
13645
|
if (oid === workdirOid) {
|
|
13613
13646
|
// ... use the workdir Stats object
|
|
13614
|
-
stats = await fs.lstat(
|
|
13647
|
+
stats = await fs.lstat(join(dir, filepath));
|
|
13615
13648
|
}
|
|
13616
13649
|
}
|
|
13617
13650
|
await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {
|
|
@@ -13650,7 +13683,7 @@ async function resetIndex({
|
|
|
13650
13683
|
async function resolveRef({
|
|
13651
13684
|
fs,
|
|
13652
13685
|
dir,
|
|
13653
|
-
gitdir =
|
|
13686
|
+
gitdir = join(dir, '.git'),
|
|
13654
13687
|
ref,
|
|
13655
13688
|
depth,
|
|
13656
13689
|
}) {
|
|
@@ -13719,23 +13752,23 @@ async function resolveRef({
|
|
|
13719
13752
|
async function setConfig({
|
|
13720
13753
|
fs: _fs,
|
|
13721
13754
|
dir,
|
|
13722
|
-
gitdir =
|
|
13723
|
-
path
|
|
13755
|
+
gitdir = join(dir, '.git'),
|
|
13756
|
+
path,
|
|
13724
13757
|
value,
|
|
13725
13758
|
append = false,
|
|
13726
13759
|
}) {
|
|
13727
13760
|
try {
|
|
13728
13761
|
assertParameter('fs', _fs);
|
|
13729
13762
|
assertParameter('gitdir', gitdir);
|
|
13730
|
-
assertParameter('path', path
|
|
13763
|
+
assertParameter('path', path);
|
|
13731
13764
|
// assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete
|
|
13732
13765
|
|
|
13733
13766
|
const fs = new FileSystem(_fs);
|
|
13734
13767
|
const config = await GitConfigManager.get({ fs, gitdir });
|
|
13735
13768
|
if (append) {
|
|
13736
|
-
await config.append(path
|
|
13769
|
+
await config.append(path, value);
|
|
13737
13770
|
} else {
|
|
13738
|
-
await config.set(path
|
|
13771
|
+
await config.set(path, value);
|
|
13739
13772
|
}
|
|
13740
13773
|
await GitConfigManager.save({ fs, gitdir, config });
|
|
13741
13774
|
} catch (err) {
|
|
@@ -13784,7 +13817,7 @@ async function setConfig({
|
|
|
13784
13817
|
async function status({
|
|
13785
13818
|
fs: _fs,
|
|
13786
13819
|
dir,
|
|
13787
|
-
gitdir =
|
|
13820
|
+
gitdir = join(dir, '.git'),
|
|
13788
13821
|
filepath,
|
|
13789
13822
|
cache = {},
|
|
13790
13823
|
}) {
|
|
@@ -13820,7 +13853,7 @@ async function status({
|
|
|
13820
13853
|
return null
|
|
13821
13854
|
}
|
|
13822
13855
|
);
|
|
13823
|
-
const stats = await fs.lstat(
|
|
13856
|
+
const stats = await fs.lstat(join(dir, filepath));
|
|
13824
13857
|
|
|
13825
13858
|
const H = treeOid !== null; // head
|
|
13826
13859
|
const I = indexEntry !== null; // index
|
|
@@ -13830,7 +13863,7 @@ async function status({
|
|
|
13830
13863
|
if (I && !compareStats(indexEntry, stats)) {
|
|
13831
13864
|
return indexEntry.oid
|
|
13832
13865
|
} else {
|
|
13833
|
-
const object = await fs.read(
|
|
13866
|
+
const object = await fs.read(join(dir, filepath));
|
|
13834
13867
|
const workdirOid = await hashObject$1({
|
|
13835
13868
|
gitdir,
|
|
13836
13869
|
type: 'blob',
|
|
@@ -14092,7 +14125,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
|
|
|
14092
14125
|
async function statusMatrix({
|
|
14093
14126
|
fs: _fs,
|
|
14094
14127
|
dir,
|
|
14095
|
-
gitdir =
|
|
14128
|
+
gitdir = join(dir, '.git'),
|
|
14096
14129
|
ref = 'HEAD',
|
|
14097
14130
|
filepaths = ['.'],
|
|
14098
14131
|
filter,
|
|
@@ -14202,7 +14235,7 @@ async function statusMatrix({
|
|
|
14202
14235
|
async function tag({
|
|
14203
14236
|
fs: _fs,
|
|
14204
14237
|
dir,
|
|
14205
|
-
gitdir =
|
|
14238
|
+
gitdir = join(dir, '.git'),
|
|
14206
14239
|
ref,
|
|
14207
14240
|
object,
|
|
14208
14241
|
force = false,
|
|
@@ -14284,7 +14317,7 @@ async function tag({
|
|
|
14284
14317
|
async function updateIndex({
|
|
14285
14318
|
fs: _fs,
|
|
14286
14319
|
dir,
|
|
14287
|
-
gitdir =
|
|
14320
|
+
gitdir = join(dir, '.git'),
|
|
14288
14321
|
cache = {},
|
|
14289
14322
|
filepath,
|
|
14290
14323
|
oid,
|
|
@@ -14308,7 +14341,7 @@ async function updateIndex({
|
|
|
14308
14341
|
|
|
14309
14342
|
if (!force) {
|
|
14310
14343
|
// Check if the file is still present in the working directory
|
|
14311
|
-
fileStats = await fs.lstat(
|
|
14344
|
+
fileStats = await fs.lstat(join(dir, filepath));
|
|
14312
14345
|
|
|
14313
14346
|
if (fileStats) {
|
|
14314
14347
|
if (fileStats.isDirectory()) {
|
|
@@ -14335,7 +14368,7 @@ async function updateIndex({
|
|
|
14335
14368
|
let fileStats;
|
|
14336
14369
|
|
|
14337
14370
|
if (!oid) {
|
|
14338
|
-
fileStats = await fs.lstat(
|
|
14371
|
+
fileStats = await fs.lstat(join(dir, filepath));
|
|
14339
14372
|
|
|
14340
14373
|
if (!fileStats) {
|
|
14341
14374
|
throw new NotFoundError(
|
|
@@ -14375,8 +14408,8 @@ async function updateIndex({
|
|
|
14375
14408
|
|
|
14376
14409
|
// Write the file to the object database
|
|
14377
14410
|
const object = stats.isSymbolicLink()
|
|
14378
|
-
? await fs.readlink(
|
|
14379
|
-
: await fs.read(
|
|
14411
|
+
? await fs.readlink(join(dir, filepath))
|
|
14412
|
+
: await fs.read(join(dir, filepath));
|
|
14380
14413
|
|
|
14381
14414
|
oid = await _writeObject({
|
|
14382
14415
|
fs,
|
|
@@ -14674,7 +14707,7 @@ function version() {
|
|
|
14674
14707
|
async function walk({
|
|
14675
14708
|
fs,
|
|
14676
14709
|
dir,
|
|
14677
|
-
gitdir =
|
|
14710
|
+
gitdir = join(dir, '.git'),
|
|
14678
14711
|
trees,
|
|
14679
14712
|
map,
|
|
14680
14713
|
reduce,
|
|
@@ -14726,7 +14759,7 @@ async function walk({
|
|
|
14726
14759
|
* console.log('oid', oid) // should be 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
|
|
14727
14760
|
*
|
|
14728
14761
|
*/
|
|
14729
|
-
async function writeBlob({ fs, dir, gitdir =
|
|
14762
|
+
async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {
|
|
14730
14763
|
try {
|
|
14731
14764
|
assertParameter('fs', fs);
|
|
14732
14765
|
assertParameter('gitdir', gitdir);
|
|
@@ -14788,7 +14821,7 @@ async function _writeCommit({ fs, gitdir, commit }) {
|
|
|
14788
14821
|
async function writeCommit({
|
|
14789
14822
|
fs,
|
|
14790
14823
|
dir,
|
|
14791
|
-
gitdir =
|
|
14824
|
+
gitdir = join(dir, '.git'),
|
|
14792
14825
|
commit,
|
|
14793
14826
|
}) {
|
|
14794
14827
|
try {
|
|
@@ -14877,7 +14910,7 @@ async function writeCommit({
|
|
|
14877
14910
|
async function writeObject({
|
|
14878
14911
|
fs: _fs,
|
|
14879
14912
|
dir,
|
|
14880
|
-
gitdir =
|
|
14913
|
+
gitdir = join(dir, '.git'),
|
|
14881
14914
|
type,
|
|
14882
14915
|
object,
|
|
14883
14916
|
format = 'parsed',
|
|
@@ -14959,7 +14992,7 @@ async function writeObject({
|
|
|
14959
14992
|
async function writeRef({
|
|
14960
14993
|
fs: _fs,
|
|
14961
14994
|
dir,
|
|
14962
|
-
gitdir =
|
|
14995
|
+
gitdir = join(dir, '.git'),
|
|
14963
14996
|
ref,
|
|
14964
14997
|
value,
|
|
14965
14998
|
force = false,
|
|
@@ -15069,7 +15102,7 @@ async function _writeTag({ fs, gitdir, tag }) {
|
|
|
15069
15102
|
* console.log('tag', oid)
|
|
15070
15103
|
*
|
|
15071
15104
|
*/
|
|
15072
|
-
async function writeTag({ fs, dir, gitdir =
|
|
15105
|
+
async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {
|
|
15073
15106
|
try {
|
|
15074
15107
|
assertParameter('fs', fs);
|
|
15075
15108
|
assertParameter('gitdir', gitdir);
|
|
@@ -15102,7 +15135,7 @@ async function writeTag({ fs, dir, gitdir = path.join(dir, '.git'), tag }) {
|
|
|
15102
15135
|
* @see TreeEntry
|
|
15103
15136
|
*
|
|
15104
15137
|
*/
|
|
15105
|
-
async function writeTree({ fs, dir, gitdir =
|
|
15138
|
+
async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {
|
|
15106
15139
|
try {
|
|
15107
15140
|
assertParameter('fs', fs);
|
|
15108
15141
|
assertParameter('gitdir', gitdir);
|