isomorphic-git 1.26.0 → 1.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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(path.join(gitdir, key), `${value.trim()}\n`, 'utf8')
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(path.join(gitdir, ref), `${value.trim()}\n`, 'utf8')
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(path.join(gitdir, ref), 'ref: ' + `${value.trim()}\n`, 'utf8')
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(path.join(gitdir, ref))));
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(path.join(gitdir, 'objects/pack'));
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}`;
@@ -3137,43 +3170,46 @@ async function _readObject({
3137
3170
  oid,
3138
3171
  getExternalRefDelta,
3139
3172
  });
3140
- }
3141
- // Finally
3142
- if (!result) {
3143
- throw new NotFoundError(oid)
3173
+
3174
+ if (!result) {
3175
+ throw new NotFoundError(oid)
3176
+ }
3177
+
3178
+ // Directly return packed result, as specified: packed objects always return the 'content' format.
3179
+ return result
3144
3180
  }
3145
3181
 
3182
+ // Loose objects are always deflated, return early
3146
3183
  if (format === 'deflated') {
3147
3184
  return result
3148
3185
  }
3149
3186
 
3187
+ // All loose objects are deflated but the hard-coded empty tree is `wrapped` so we have to check if we need to inflate the object.
3150
3188
  if (result.format === 'deflated') {
3151
3189
  result.object = Buffer.from(await inflate(result.object));
3152
3190
  result.format = 'wrapped';
3153
3191
  }
3154
3192
 
3155
- if (result.format === 'wrapped') {
3156
- if (format === 'wrapped' && result.format === 'wrapped') {
3157
- return result
3158
- }
3159
- const sha = await shasum(result.object);
3160
- if (sha !== oid) {
3161
- throw new InternalError(
3162
- `SHA check failed! Expected ${oid}, computed ${sha}`
3163
- )
3164
- }
3165
- const { object, type } = GitObject.unwrap(result.object);
3166
- result.type = type;
3167
- result.object = object;
3168
- result.format = 'content';
3193
+ if (format === 'wrapped') {
3194
+ return result
3195
+ }
3196
+
3197
+ const sha = await shasum(result.object);
3198
+ if (sha !== oid) {
3199
+ throw new InternalError(
3200
+ `SHA check failed! Expected ${oid}, computed ${sha}`
3201
+ )
3169
3202
  }
3203
+ const { object, type } = GitObject.unwrap(result.object);
3204
+ result.type = type;
3205
+ result.object = object;
3206
+ result.format = 'content';
3170
3207
 
3171
- if (result.format === 'content') {
3172
- if (format === 'content') return result
3173
- return
3208
+ if (format === 'content') {
3209
+ return result
3174
3210
  }
3175
3211
 
3176
- throw new InternalError(`invalid format "${result.format}"`)
3212
+ throw new InternalError(`invalid requested format "${format}"`)
3177
3213
  }
3178
3214
 
3179
3215
  class AlreadyExistsError extends BaseError {
@@ -4022,9 +4058,9 @@ class GitWalkerRepo {
4022
4058
  const tree = GitTree.from(object);
4023
4059
  // cache all entries
4024
4060
  for (const entry of tree) {
4025
- map.set(path.join(filepath, entry.path), entry);
4061
+ map.set(join(filepath, entry.path), entry);
4026
4062
  }
4027
- return tree.entries().map(entry => path.join(filepath, entry.path))
4063
+ return tree.entries().map(entry => join(filepath, entry.path))
4028
4064
  }
4029
4065
 
4030
4066
  async type(entry) {
@@ -4135,9 +4171,9 @@ class GitWalkerFs {
4135
4171
  async readdir(entry) {
4136
4172
  const filepath = entry._fullpath;
4137
4173
  const { fs, dir } = this;
4138
- const names = await fs.readdir(path.join(dir, filepath));
4174
+ const names = await fs.readdir(join(dir, filepath));
4139
4175
  if (names === null) return null
4140
- return names.map(name => path.join(filepath, name))
4176
+ return names.map(name => join(filepath, name))
4141
4177
  }
4142
4178
 
4143
4179
  async type(entry) {
@@ -4444,7 +4480,7 @@ async function rmRecursive(fs, filepath) {
4444
4480
  } else if (entries.length) {
4445
4481
  await Promise.all(
4446
4482
  entries.map(entry => {
4447
- const subpath = path.join(filepath, entry);
4483
+ const subpath = join(filepath, entry);
4448
4484
  return fs.lstat(subpath).then(stat => {
4449
4485
  if (!stat) return
4450
4486
  return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath)
@@ -4789,7 +4825,7 @@ async function modified(entry, base) {
4789
4825
  async function abortMerge({
4790
4826
  fs: _fs,
4791
4827
  dir,
4792
- gitdir = path.join(dir, '.git'),
4828
+ gitdir = join(dir, '.git'),
4793
4829
  commit = 'HEAD',
4794
4830
  cache = {},
4795
4831
  }) {
@@ -4868,21 +4904,21 @@ async function abortMerge({
4868
4904
  // I'm putting this in a Manager because I reckon it could benefit
4869
4905
  // from a LOT of caching.
4870
4906
  class GitIgnoreManager {
4871
- static async isIgnored({ fs, dir, gitdir = path.join(dir, '.git'), filepath }) {
4907
+ static async isIgnored({ fs, dir, gitdir = join(dir, '.git'), filepath }) {
4872
4908
  // ALWAYS ignore ".git" folders.
4873
4909
  if (basename(filepath) === '.git') return true
4874
4910
  // '.' is not a valid gitignore entry, so '.' is never ignored
4875
4911
  if (filepath === '.') return false
4876
4912
  // Check and load exclusion rules from project exclude file (.git/info/exclude)
4877
4913
  let excludes = '';
4878
- const excludesFile = path.join(gitdir, 'info', 'exclude');
4914
+ const excludesFile = join(gitdir, 'info', 'exclude');
4879
4915
  if (await fs.exists(excludesFile)) {
4880
4916
  excludes = await fs.read(excludesFile, 'utf8');
4881
4917
  }
4882
4918
  // Find all the .gitignore files that could affect this file
4883
4919
  const pairs = [
4884
4920
  {
4885
- gitignore: path.join(dir, '.gitignore'),
4921
+ gitignore: join(dir, '.gitignore'),
4886
4922
  filepath,
4887
4923
  },
4888
4924
  ];
@@ -4891,7 +4927,7 @@ class GitIgnoreManager {
4891
4927
  const folder = pieces.slice(0, i).join('/');
4892
4928
  const file = pieces.slice(i).join('/');
4893
4929
  pairs.push({
4894
- gitignore: path.join(dir, folder, '.gitignore'),
4930
+ gitignore: join(dir, folder, '.gitignore'),
4895
4931
  filepath: file,
4896
4932
  });
4897
4933
  }
@@ -5020,7 +5056,7 @@ function posixifyPathBuffer(buffer) {
5020
5056
  async function add({
5021
5057
  fs: _fs,
5022
5058
  dir,
5023
- gitdir = path.join(dir, '.git'),
5059
+ gitdir = join(dir, '.git'),
5024
5060
  filepath,
5025
5061
  cache = {},
5026
5062
  force = false,
@@ -5071,18 +5107,18 @@ async function addToIndex({
5071
5107
  });
5072
5108
  if (ignored) return
5073
5109
  }
5074
- const stats = await fs.lstat(path.join(dir, currentFilepath));
5110
+ const stats = await fs.lstat(join(dir, currentFilepath));
5075
5111
  if (!stats) throw new NotFoundError(currentFilepath)
5076
5112
 
5077
5113
  if (stats.isDirectory()) {
5078
- const children = await fs.readdir(path.join(dir, currentFilepath));
5114
+ const children = await fs.readdir(join(dir, currentFilepath));
5079
5115
  if (parallel) {
5080
5116
  const promises = children.map(child =>
5081
5117
  addToIndex({
5082
5118
  dir,
5083
5119
  gitdir,
5084
5120
  fs,
5085
- filepath: [path.join(currentFilepath, child)],
5121
+ filepath: [join(currentFilepath, child)],
5086
5122
  index,
5087
5123
  force,
5088
5124
  parallel,
@@ -5095,7 +5131,7 @@ async function addToIndex({
5095
5131
  dir,
5096
5132
  gitdir,
5097
5133
  fs,
5098
- filepath: [path.join(currentFilepath, child)],
5134
+ filepath: [join(currentFilepath, child)],
5099
5135
  index,
5100
5136
  force,
5101
5137
  parallel,
@@ -5106,8 +5142,8 @@ async function addToIndex({
5106
5142
  const config = await GitConfigManager.get({ fs, gitdir });
5107
5143
  const autocrlf = await config.get('core.autocrlf');
5108
5144
  const object = stats.isSymbolicLink()
5109
- ? await fs.readlink(path.join(dir, currentFilepath)).then(posixifyPathBuffer)
5110
- : await fs.read(path.join(dir, currentFilepath), { autocrlf });
5145
+ ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
5146
+ : await fs.read(join(dir, currentFilepath), { autocrlf });
5111
5147
  if (object === null) throw new NotFoundError(currentFilepath)
5112
5148
  const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
5113
5149
  index.insert({ filepath: currentFilepath, stats, oid });
@@ -5612,7 +5648,7 @@ async function addNote({
5612
5648
  fs: _fs,
5613
5649
  onSign,
5614
5650
  dir,
5615
- gitdir = path.join(dir, '.git'),
5651
+ gitdir = join(dir, '.git'),
5616
5652
  ref = 'refs/notes/commits',
5617
5653
  oid,
5618
5654
  note,
@@ -5727,7 +5763,7 @@ async function _addRemote({ fs, gitdir, remote, url, force }) {
5727
5763
  async function addRemote({
5728
5764
  fs,
5729
5765
  dir,
5730
- gitdir = path.join(dir, '.git'),
5766
+ gitdir = join(dir, '.git'),
5731
5767
  remote,
5732
5768
  url,
5733
5769
  force = false,
@@ -5878,7 +5914,7 @@ async function annotatedTag({
5878
5914
  fs: _fs,
5879
5915
  onSign,
5880
5916
  dir,
5881
- gitdir = path.join(dir, '.git'),
5917
+ gitdir = join(dir, '.git'),
5882
5918
  ref,
5883
5919
  tagger: _tagger,
5884
5920
  message = ref,
@@ -6009,7 +6045,7 @@ async function _branch({
6009
6045
  async function branch({
6010
6046
  fs,
6011
6047
  dir,
6012
- gitdir = path.join(dir, '.git'),
6048
+ gitdir = join(dir, '.git'),
6013
6049
  ref,
6014
6050
  object,
6015
6051
  checkout = false,
@@ -6697,7 +6733,7 @@ async function checkout({
6697
6733
  onProgress,
6698
6734
  onPostCheckout,
6699
6735
  dir,
6700
- gitdir = path.join(dir, '.git'),
6736
+ gitdir = join(dir, '.git'),
6701
6737
  remote = 'origin',
6702
6738
  ref: _ref,
6703
6739
  filepaths,
@@ -7302,7 +7338,7 @@ let lock$2 = null;
7302
7338
  class GitShallowManager {
7303
7339
  static async read({ fs, gitdir }) {
7304
7340
  if (lock$2 === null) lock$2 = new AsyncLock();
7305
- const filepath = path.join(gitdir, 'shallow');
7341
+ const filepath = join(gitdir, 'shallow');
7306
7342
  const oids = new Set();
7307
7343
  await lock$2.acquire(filepath, async function() {
7308
7344
  const text = await fs.read(filepath, { encoding: 'utf8' });
@@ -7318,7 +7354,7 @@ class GitShallowManager {
7318
7354
 
7319
7355
  static async write({ fs, gitdir, oids }) {
7320
7356
  if (lock$2 === null) lock$2 = new AsyncLock();
7321
- const filepath = path.join(gitdir, 'shallow');
7357
+ const filepath = join(gitdir, 'shallow');
7322
7358
  if (oids.size > 0) {
7323
7359
  const text = [...oids].join('\n') + '\n';
7324
7360
  await lock$2.acquire(filepath, async function() {
@@ -7349,7 +7385,7 @@ async function hasObjectPacked({
7349
7385
  }) {
7350
7386
  // Check to see if it's in a packfile.
7351
7387
  // Iterate through all the .idx files
7352
- let list = await fs.readdir(path.join(gitdir, 'objects/pack'));
7388
+ let list = await fs.readdir(join(gitdir, 'objects/pack'));
7353
7389
  list = list.filter(x => x.endsWith('.idx'));
7354
7390
  for (const filename of list) {
7355
7391
  const indexFile = `${gitdir}/objects/pack/${filename}`;
@@ -7415,8 +7451,8 @@ function filterCapabilities(server, client) {
7415
7451
 
7416
7452
  const pkg = {
7417
7453
  name: 'isomorphic-git',
7418
- version: '1.26.0',
7419
- agent: 'git/isomorphic-git@1.26.0',
7454
+ version: '1.26.2',
7455
+ agent: 'git/isomorphic-git@1.26.2',
7420
7456
  };
7421
7457
 
7422
7458
  class FIFO {
@@ -8082,7 +8118,7 @@ async function _fetch({
8082
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.
8083
8119
  if (packfileSha !== '' && !emptyPackfile(packfile)) {
8084
8120
  res.packfile = `objects/pack/pack-${packfileSha}.pack`;
8085
- const fullpath = path.join(gitdir, res.packfile);
8121
+ const fullpath = join(gitdir, res.packfile);
8086
8122
  await fs.write(fullpath, packfile);
8087
8123
  const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
8088
8124
  const idx = await GitPackIndex.fromPack({
@@ -8112,7 +8148,7 @@ async function _init({
8112
8148
  fs,
8113
8149
  bare = false,
8114
8150
  dir,
8115
- gitdir = bare ? dir : path.join(dir, '.git'),
8151
+ gitdir = bare ? dir : join(dir, '.git'),
8116
8152
  defaultBranch = 'master',
8117
8153
  }) {
8118
8154
  // Don't overwrite an existing config
@@ -8310,7 +8346,7 @@ async function clone({
8310
8346
  onAuthFailure,
8311
8347
  onPostCheckout,
8312
8348
  dir,
8313
- gitdir = path.join(dir, '.git'),
8349
+ gitdir = join(dir, '.git'),
8314
8350
  url,
8315
8351
  corsProxy = undefined,
8316
8352
  ref = undefined,
@@ -8413,7 +8449,7 @@ async function commit({
8413
8449
  fs: _fs,
8414
8450
  onSign,
8415
8451
  dir,
8416
- gitdir = path.join(dir, '.git'),
8452
+ gitdir = join(dir, '.git'),
8417
8453
  message,
8418
8454
  author: _author,
8419
8455
  committer: _committer,
@@ -8492,7 +8528,7 @@ async function commit({
8492
8528
  async function currentBranch({
8493
8529
  fs,
8494
8530
  dir,
8495
- gitdir = path.join(dir, '.git'),
8531
+ gitdir = join(dir, '.git'),
8496
8532
  fullname = false,
8497
8533
  test = false,
8498
8534
  }) {
@@ -8563,7 +8599,7 @@ async function _deleteBranch({ fs, gitdir, ref }) {
8563
8599
  async function deleteBranch({
8564
8600
  fs,
8565
8601
  dir,
8566
- gitdir = path.join(dir, '.git'),
8602
+ gitdir = join(dir, '.git'),
8567
8603
  ref,
8568
8604
  }) {
8569
8605
  try {
@@ -8598,7 +8634,7 @@ async function deleteBranch({
8598
8634
  * console.log('done')
8599
8635
  *
8600
8636
  */
8601
- async function deleteRef({ fs, dir, gitdir = path.join(dir, '.git'), ref }) {
8637
+ async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
8602
8638
  try {
8603
8639
  assertParameter('fs', fs);
8604
8640
  assertParameter('ref', ref);
@@ -8646,7 +8682,7 @@ async function _deleteRemote({ fs, gitdir, remote }) {
8646
8682
  async function deleteRemote({
8647
8683
  fs,
8648
8684
  dir,
8649
- gitdir = path.join(dir, '.git'),
8685
+ gitdir = join(dir, '.git'),
8650
8686
  remote,
8651
8687
  }) {
8652
8688
  try {
@@ -8703,7 +8739,7 @@ async function _deleteTag({ fs, gitdir, ref }) {
8703
8739
  * console.log('done')
8704
8740
  *
8705
8741
  */
8706
- async function deleteTag({ fs, dir, gitdir = path.join(dir, '.git'), ref }) {
8742
+ async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {
8707
8743
  try {
8708
8744
  assertParameter('fs', fs);
8709
8745
  assertParameter('ref', ref);
@@ -8735,7 +8771,7 @@ async function expandOidPacked({
8735
8771
  }) {
8736
8772
  // Iterate through all the .pack files
8737
8773
  const results = [];
8738
- let list = await fs.readdir(path.join(gitdir, 'objects/pack'));
8774
+ let list = await fs.readdir(join(gitdir, 'objects/pack'));
8739
8775
  list = list.filter(x => x.endsWith('.idx'));
8740
8776
  for (const filename of list) {
8741
8777
  const indexFile = `${gitdir}/objects/pack/${filename}`;
@@ -8805,7 +8841,7 @@ async function _expandOid({ fs, cache, gitdir, oid: short }) {
8805
8841
  async function expandOid({
8806
8842
  fs,
8807
8843
  dir,
8808
- gitdir = path.join(dir, '.git'),
8844
+ gitdir = join(dir, '.git'),
8809
8845
  oid,
8810
8846
  cache = {},
8811
8847
  }) {
@@ -8843,7 +8879,7 @@ async function expandOid({
8843
8879
  * console.log(fullRef)
8844
8880
  *
8845
8881
  */
8846
- async function expandRef({ fs, dir, gitdir = path.join(dir, '.git'), ref }) {
8882
+ async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {
8847
8883
  try {
8848
8884
  assertParameter('fs', fs);
8849
8885
  assertParameter('gitdir', gitdir);
@@ -8983,7 +9019,7 @@ async function mergeTree({
8983
9019
  fs,
8984
9020
  cache,
8985
9021
  dir,
8986
- gitdir = path.join(dir, '.git'),
9022
+ gitdir = join(dir, '.git'),
8987
9023
  index,
8988
9024
  ourOid,
8989
9025
  baseOid,
@@ -9640,7 +9676,7 @@ async function fastForward({
9640
9676
  onAuthSuccess,
9641
9677
  onAuthFailure,
9642
9678
  dir,
9643
- gitdir = path.join(dir, '.git'),
9679
+ gitdir = join(dir, '.git'),
9644
9680
  ref,
9645
9681
  url,
9646
9682
  remote,
@@ -9759,7 +9795,7 @@ async function fetch({
9759
9795
  onAuthSuccess,
9760
9796
  onAuthFailure,
9761
9797
  dir,
9762
- gitdir = path.join(dir, '.git'),
9798
+ gitdir = join(dir, '.git'),
9763
9799
  ref,
9764
9800
  remote,
9765
9801
  remoteRef,
@@ -9828,7 +9864,7 @@ async function fetch({
9828
9864
  async function findMergeBase({
9829
9865
  fs,
9830
9866
  dir,
9831
- gitdir = path.join(dir, '.git'),
9867
+ gitdir = join(dir, '.git'),
9832
9868
  oids,
9833
9869
  cache = {},
9834
9870
  }) {
@@ -9863,7 +9899,7 @@ async function findMergeBase({
9863
9899
  * @returns {Promise<string>} Resolves successfully with a root git directory path
9864
9900
  */
9865
9901
  async function _findRoot({ fs, filepath }) {
9866
- if (await fs.exists(path.join(filepath, '.git'))) {
9902
+ if (await fs.exists(join(filepath, '.git'))) {
9867
9903
  return filepath
9868
9904
  } else {
9869
9905
  const parent = dirname(filepath);
@@ -9935,16 +9971,16 @@ async function findRoot({ fs, filepath }) {
9935
9971
  * console.log(value)
9936
9972
  *
9937
9973
  */
9938
- async function getConfig({ fs, dir, gitdir = path.join(dir, '.git'), path: path$1 }) {
9974
+ async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {
9939
9975
  try {
9940
9976
  assertParameter('fs', fs);
9941
9977
  assertParameter('gitdir', gitdir);
9942
- assertParameter('path', path$1);
9978
+ assertParameter('path', path);
9943
9979
 
9944
9980
  return await _getConfig({
9945
9981
  fs: new FileSystem(fs),
9946
9982
  gitdir,
9947
- path: path$1,
9983
+ path,
9948
9984
  })
9949
9985
  } catch (err) {
9950
9986
  err.caller = 'git.getConfig';
@@ -9989,18 +10025,18 @@ async function _getConfigAll({ fs, gitdir, path }) {
9989
10025
  async function getConfigAll({
9990
10026
  fs,
9991
10027
  dir,
9992
- gitdir = path.join(dir, '.git'),
9993
- path: path$1,
10028
+ gitdir = join(dir, '.git'),
10029
+ path,
9994
10030
  }) {
9995
10031
  try {
9996
10032
  assertParameter('fs', fs);
9997
10033
  assertParameter('gitdir', gitdir);
9998
- assertParameter('path', path$1);
10034
+ assertParameter('path', path);
9999
10035
 
10000
10036
  return await _getConfigAll({
10001
10037
  fs: new FileSystem(fs),
10002
10038
  gitdir,
10003
- path: path$1,
10039
+ path,
10004
10040
  })
10005
10041
  } catch (err) {
10006
10042
  err.caller = 'git.getConfigAll';
@@ -10354,7 +10390,7 @@ async function _indexPack({
10354
10390
  filepath,
10355
10391
  }) {
10356
10392
  try {
10357
- filepath = path.join(dir, filepath);
10393
+ filepath = join(dir, filepath);
10358
10394
  const pack = await fs.read(filepath);
10359
10395
  const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid });
10360
10396
  const idx = await GitPackIndex.fromPack({
@@ -10407,7 +10443,7 @@ async function indexPack({
10407
10443
  fs,
10408
10444
  onProgress,
10409
10445
  dir,
10410
- gitdir = path.join(dir, '.git'),
10446
+ gitdir = join(dir, '.git'),
10411
10447
  filepath,
10412
10448
  cache = {},
10413
10449
  }) {
@@ -10453,7 +10489,7 @@ async function init({
10453
10489
  fs,
10454
10490
  bare = false,
10455
10491
  dir,
10456
- gitdir = bare ? dir : path.join(dir, '.git'),
10492
+ gitdir = bare ? dir : join(dir, '.git'),
10457
10493
  defaultBranch = 'master',
10458
10494
  }) {
10459
10495
  try {
@@ -10574,7 +10610,7 @@ async function _isDescendent({
10574
10610
  async function isDescendent({
10575
10611
  fs,
10576
10612
  dir,
10577
- gitdir = path.join(dir, '.git'),
10613
+ gitdir = join(dir, '.git'),
10578
10614
  oid,
10579
10615
  ancestor,
10580
10616
  depth = -1,
@@ -10620,7 +10656,7 @@ async function isDescendent({
10620
10656
  async function isIgnored({
10621
10657
  fs,
10622
10658
  dir,
10623
- gitdir = path.join(dir, '.git'),
10659
+ gitdir = join(dir, '.git'),
10624
10660
  filepath,
10625
10661
  }) {
10626
10662
  try {
@@ -10673,7 +10709,7 @@ async function isIgnored({
10673
10709
  async function listBranches({
10674
10710
  fs,
10675
10711
  dir,
10676
- gitdir = path.join(dir, '.git'),
10712
+ gitdir = join(dir, '.git'),
10677
10713
  remote,
10678
10714
  }) {
10679
10715
  try {
@@ -10742,10 +10778,10 @@ async function accumulateFilesFromOid({
10742
10778
  gitdir,
10743
10779
  oid: entry.oid,
10744
10780
  filenames,
10745
- prefix: path.join(prefix, entry.path),
10781
+ prefix: join(prefix, entry.path),
10746
10782
  });
10747
10783
  } else {
10748
- filenames.push(path.join(prefix, entry.path));
10784
+ filenames.push(join(prefix, entry.path));
10749
10785
  }
10750
10786
  }
10751
10787
  }
@@ -10779,7 +10815,7 @@ async function accumulateFilesFromOid({
10779
10815
  async function listFiles({
10780
10816
  fs,
10781
10817
  dir,
10782
- gitdir = path.join(dir, '.git'),
10818
+ gitdir = join(dir, '.git'),
10783
10819
  ref,
10784
10820
  cache = {},
10785
10821
  }) {
@@ -10858,7 +10894,7 @@ async function _listNotes({ fs, cache, gitdir, ref }) {
10858
10894
  async function listNotes({
10859
10895
  fs,
10860
10896
  dir,
10861
- gitdir = path.join(dir, '.git'),
10897
+ gitdir = join(dir, '.git'),
10862
10898
  ref = 'refs/notes/commits',
10863
10899
  cache = {},
10864
10900
  }) {
@@ -10917,7 +10953,7 @@ async function _listRemotes({ fs, gitdir }) {
10917
10953
  * console.log(remotes)
10918
10954
  *
10919
10955
  */
10920
- async function listRemotes({ fs, dir, gitdir = path.join(dir, '.git') }) {
10956
+ async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {
10921
10957
  try {
10922
10958
  assertParameter('fs', fs);
10923
10959
  assertParameter('gitdir', gitdir);
@@ -11161,7 +11197,7 @@ async function listServerRefs({
11161
11197
  * console.log(tags)
11162
11198
  *
11163
11199
  */
11164
- async function listTags({ fs, dir, gitdir = path.join(dir, '.git') }) {
11200
+ async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {
11165
11201
  try {
11166
11202
  assertParameter('fs', fs);
11167
11203
  assertParameter('gitdir', gitdir);
@@ -11262,7 +11298,7 @@ async function _resolveFileId({
11262
11298
  const walks = tree.entries().map(function(entry) {
11263
11299
  let result;
11264
11300
  if (entry.oid === fileId) {
11265
- result = path.join(parentPath, entry.path);
11301
+ result = join(parentPath, entry.path);
11266
11302
  filepaths.push(result);
11267
11303
  } else if (entry.type === 'tree') {
11268
11304
  result = _readObject({
@@ -11279,7 +11315,7 @@ async function _resolveFileId({
11279
11315
  fileId,
11280
11316
  oid,
11281
11317
  filepaths,
11282
- parentPath: path.join(parentPath, entry.path),
11318
+ parentPath: join(parentPath, entry.path),
11283
11319
  })
11284
11320
  });
11285
11321
  }
@@ -11489,7 +11525,7 @@ async function _log({
11489
11525
  async function log({
11490
11526
  fs,
11491
11527
  dir,
11492
- gitdir = path.join(dir, '.git'),
11528
+ gitdir = join(dir, '.git'),
11493
11529
  filepath,
11494
11530
  ref = 'HEAD',
11495
11531
  depth,
@@ -11637,7 +11673,7 @@ async function merge({
11637
11673
  fs: _fs,
11638
11674
  onSign,
11639
11675
  dir,
11640
- gitdir = path.join(dir, '.git'),
11676
+ gitdir = join(dir, '.git'),
11641
11677
  ours,
11642
11678
  theirs,
11643
11679
  fastForward = true,
@@ -11723,7 +11759,7 @@ async function _pack({
11723
11759
  fs,
11724
11760
  cache,
11725
11761
  dir,
11726
- gitdir = path.join(dir, '.git'),
11762
+ gitdir = join(dir, '.git'),
11727
11763
  oids,
11728
11764
  }) {
11729
11765
  const hash = new Hash();
@@ -11799,7 +11835,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
11799
11835
  const packfileSha = packfile.slice(-20).toString('hex');
11800
11836
  const filename = `pack-${packfileSha}.pack`;
11801
11837
  if (write) {
11802
- await fs.write(path.join(gitdir, `objects/pack/${filename}`), packfile);
11838
+ await fs.write(join(gitdir, `objects/pack/${filename}`), packfile);
11803
11839
  return { filename }
11804
11840
  }
11805
11841
  return {
@@ -11844,7 +11880,7 @@ async function _packObjects({ fs, cache, gitdir, oids, write }) {
11844
11880
  async function packObjects({
11845
11881
  fs,
11846
11882
  dir,
11847
- gitdir = path.join(dir, '.git'),
11883
+ gitdir = join(dir, '.git'),
11848
11884
  oids,
11849
11885
  write = false,
11850
11886
  cache = {},
@@ -11928,7 +11964,7 @@ async function pull({
11928
11964
  onAuthSuccess,
11929
11965
  onAuthFailure,
11930
11966
  dir,
11931
- gitdir = path.join(dir, '.git'),
11967
+ gitdir = join(dir, '.git'),
11932
11968
  ref,
11933
11969
  url,
11934
11970
  remote,
@@ -12008,7 +12044,7 @@ async function listCommitsAndTags({
12008
12044
  fs,
12009
12045
  cache,
12010
12046
  dir,
12011
- gitdir = path.join(dir, '.git'),
12047
+ gitdir = join(dir, '.git'),
12012
12048
  start,
12013
12049
  finish,
12014
12050
  }) {
@@ -12071,7 +12107,7 @@ async function listObjects({
12071
12107
  fs,
12072
12108
  cache,
12073
12109
  dir,
12074
- gitdir = path.join(dir, '.git'),
12110
+ gitdir = join(dir, '.git'),
12075
12111
  oids,
12076
12112
  }) {
12077
12113
  const visited = new Set();
@@ -12513,7 +12549,7 @@ async function push({
12513
12549
  onAuthFailure,
12514
12550
  onPrePush,
12515
12551
  dir,
12516
- gitdir = path.join(dir, '.git'),
12552
+ gitdir = join(dir, '.git'),
12517
12553
  ref,
12518
12554
  remoteRef,
12519
12555
  remote = 'origin',
@@ -12648,7 +12684,7 @@ async function _readBlob({
12648
12684
  async function readBlob({
12649
12685
  fs,
12650
12686
  dir,
12651
- gitdir = path.join(dir, '.git'),
12687
+ gitdir = join(dir, '.git'),
12652
12688
  oid,
12653
12689
  filepath,
12654
12690
  cache = {},
@@ -12698,7 +12734,7 @@ async function readBlob({
12698
12734
  async function readCommit({
12699
12735
  fs,
12700
12736
  dir,
12701
- gitdir = path.join(dir, '.git'),
12737
+ gitdir = join(dir, '.git'),
12702
12738
  oid,
12703
12739
  cache = {},
12704
12740
  }) {
@@ -12772,7 +12808,7 @@ async function _readNote({
12772
12808
  async function readNote({
12773
12809
  fs,
12774
12810
  dir,
12775
- gitdir = path.join(dir, '.git'),
12811
+ gitdir = join(dir, '.git'),
12776
12812
  ref = 'refs/notes/commits',
12777
12813
  oid,
12778
12814
  cache = {},
@@ -12989,7 +13025,7 @@ async function readNote({
12989
13025
  async function readObject({
12990
13026
  fs: _fs,
12991
13027
  dir,
12992
- gitdir = path.join(dir, '.git'),
13028
+ gitdir = join(dir, '.git'),
12993
13029
  oid,
12994
13030
  format = 'parsed',
12995
13031
  filepath = undefined,
@@ -13126,7 +13162,7 @@ async function _readTag({ fs, cache, gitdir, oid }) {
13126
13162
  async function readTag({
13127
13163
  fs,
13128
13164
  dir,
13129
- gitdir = path.join(dir, '.git'),
13165
+ gitdir = join(dir, '.git'),
13130
13166
  oid,
13131
13167
  cache = {},
13132
13168
  }) {
@@ -13176,7 +13212,7 @@ async function readTag({
13176
13212
  async function readTree({
13177
13213
  fs,
13178
13214
  dir,
13179
- gitdir = path.join(dir, '.git'),
13215
+ gitdir = join(dir, '.git'),
13180
13216
  oid,
13181
13217
  filepath = undefined,
13182
13218
  cache = {},
@@ -13223,7 +13259,7 @@ async function readTree({
13223
13259
  async function remove({
13224
13260
  fs: _fs,
13225
13261
  dir,
13226
- gitdir = path.join(dir, '.git'),
13262
+ gitdir = join(dir, '.git'),
13227
13263
  filepath,
13228
13264
  cache = {},
13229
13265
  }) {
@@ -13359,7 +13395,7 @@ async function removeNote({
13359
13395
  fs: _fs,
13360
13396
  onSign,
13361
13397
  dir,
13362
- gitdir = path.join(dir, '.git'),
13398
+ gitdir = join(dir, '.git'),
13363
13399
  ref = 'refs/notes/commits',
13364
13400
  oid,
13365
13401
  author: _author,
@@ -13491,7 +13527,7 @@ async function _renameBranch({
13491
13527
  async function renameBranch({
13492
13528
  fs,
13493
13529
  dir,
13494
- gitdir = path.join(dir, '.git'),
13530
+ gitdir = join(dir, '.git'),
13495
13531
  ref,
13496
13532
  oldref,
13497
13533
  checkout = false,
@@ -13543,7 +13579,7 @@ async function hashObject$1({ gitdir, type, object }) {
13543
13579
  async function resetIndex({
13544
13580
  fs: _fs,
13545
13581
  dir,
13546
- gitdir = path.join(dir, '.git'),
13582
+ gitdir = join(dir, '.git'),
13547
13583
  filepath,
13548
13584
  ref,
13549
13585
  cache = {},
@@ -13598,7 +13634,7 @@ async function resetIndex({
13598
13634
  size: 0,
13599
13635
  };
13600
13636
  // If the file exists in the workdir...
13601
- const object = dir && (await fs.read(path.join(dir, filepath)));
13637
+ const object = dir && (await fs.read(join(dir, filepath)));
13602
13638
  if (object) {
13603
13639
  // ... and has the same hash as the desired state...
13604
13640
  workdirOid = await hashObject$1({
@@ -13608,7 +13644,7 @@ async function resetIndex({
13608
13644
  });
13609
13645
  if (oid === workdirOid) {
13610
13646
  // ... use the workdir Stats object
13611
- stats = await fs.lstat(path.join(dir, filepath));
13647
+ stats = await fs.lstat(join(dir, filepath));
13612
13648
  }
13613
13649
  }
13614
13650
  await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {
@@ -13647,7 +13683,7 @@ async function resetIndex({
13647
13683
  async function resolveRef({
13648
13684
  fs,
13649
13685
  dir,
13650
- gitdir = path.join(dir, '.git'),
13686
+ gitdir = join(dir, '.git'),
13651
13687
  ref,
13652
13688
  depth,
13653
13689
  }) {
@@ -13716,23 +13752,23 @@ async function resolveRef({
13716
13752
  async function setConfig({
13717
13753
  fs: _fs,
13718
13754
  dir,
13719
- gitdir = path.join(dir, '.git'),
13720
- path: path$1,
13755
+ gitdir = join(dir, '.git'),
13756
+ path,
13721
13757
  value,
13722
13758
  append = false,
13723
13759
  }) {
13724
13760
  try {
13725
13761
  assertParameter('fs', _fs);
13726
13762
  assertParameter('gitdir', gitdir);
13727
- assertParameter('path', path$1);
13763
+ assertParameter('path', path);
13728
13764
  // assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete
13729
13765
 
13730
13766
  const fs = new FileSystem(_fs);
13731
13767
  const config = await GitConfigManager.get({ fs, gitdir });
13732
13768
  if (append) {
13733
- await config.append(path$1, value);
13769
+ await config.append(path, value);
13734
13770
  } else {
13735
- await config.set(path$1, value);
13771
+ await config.set(path, value);
13736
13772
  }
13737
13773
  await GitConfigManager.save({ fs, gitdir, config });
13738
13774
  } catch (err) {
@@ -13781,7 +13817,7 @@ async function setConfig({
13781
13817
  async function status({
13782
13818
  fs: _fs,
13783
13819
  dir,
13784
- gitdir = path.join(dir, '.git'),
13820
+ gitdir = join(dir, '.git'),
13785
13821
  filepath,
13786
13822
  cache = {},
13787
13823
  }) {
@@ -13817,7 +13853,7 @@ async function status({
13817
13853
  return null
13818
13854
  }
13819
13855
  );
13820
- const stats = await fs.lstat(path.join(dir, filepath));
13856
+ const stats = await fs.lstat(join(dir, filepath));
13821
13857
 
13822
13858
  const H = treeOid !== null; // head
13823
13859
  const I = indexEntry !== null; // index
@@ -13827,7 +13863,7 @@ async function status({
13827
13863
  if (I && !compareStats(indexEntry, stats)) {
13828
13864
  return indexEntry.oid
13829
13865
  } else {
13830
- const object = await fs.read(path.join(dir, filepath));
13866
+ const object = await fs.read(join(dir, filepath));
13831
13867
  const workdirOid = await hashObject$1({
13832
13868
  gitdir,
13833
13869
  type: 'blob',
@@ -14089,7 +14125,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
14089
14125
  async function statusMatrix({
14090
14126
  fs: _fs,
14091
14127
  dir,
14092
- gitdir = path.join(dir, '.git'),
14128
+ gitdir = join(dir, '.git'),
14093
14129
  ref = 'HEAD',
14094
14130
  filepaths = ['.'],
14095
14131
  filter,
@@ -14199,7 +14235,7 @@ async function statusMatrix({
14199
14235
  async function tag({
14200
14236
  fs: _fs,
14201
14237
  dir,
14202
- gitdir = path.join(dir, '.git'),
14238
+ gitdir = join(dir, '.git'),
14203
14239
  ref,
14204
14240
  object,
14205
14241
  force = false,
@@ -14281,7 +14317,7 @@ async function tag({
14281
14317
  async function updateIndex({
14282
14318
  fs: _fs,
14283
14319
  dir,
14284
- gitdir = path.join(dir, '.git'),
14320
+ gitdir = join(dir, '.git'),
14285
14321
  cache = {},
14286
14322
  filepath,
14287
14323
  oid,
@@ -14305,7 +14341,7 @@ async function updateIndex({
14305
14341
 
14306
14342
  if (!force) {
14307
14343
  // Check if the file is still present in the working directory
14308
- fileStats = await fs.lstat(path.join(dir, filepath));
14344
+ fileStats = await fs.lstat(join(dir, filepath));
14309
14345
 
14310
14346
  if (fileStats) {
14311
14347
  if (fileStats.isDirectory()) {
@@ -14332,7 +14368,7 @@ async function updateIndex({
14332
14368
  let fileStats;
14333
14369
 
14334
14370
  if (!oid) {
14335
- fileStats = await fs.lstat(path.join(dir, filepath));
14371
+ fileStats = await fs.lstat(join(dir, filepath));
14336
14372
 
14337
14373
  if (!fileStats) {
14338
14374
  throw new NotFoundError(
@@ -14372,8 +14408,8 @@ async function updateIndex({
14372
14408
 
14373
14409
  // Write the file to the object database
14374
14410
  const object = stats.isSymbolicLink()
14375
- ? await fs.readlink(path.join(dir, filepath))
14376
- : await fs.read(path.join(dir, filepath));
14411
+ ? await fs.readlink(join(dir, filepath))
14412
+ : await fs.read(join(dir, filepath));
14377
14413
 
14378
14414
  oid = await _writeObject({
14379
14415
  fs,
@@ -14671,7 +14707,7 @@ function version() {
14671
14707
  async function walk({
14672
14708
  fs,
14673
14709
  dir,
14674
- gitdir = path.join(dir, '.git'),
14710
+ gitdir = join(dir, '.git'),
14675
14711
  trees,
14676
14712
  map,
14677
14713
  reduce,
@@ -14723,7 +14759,7 @@ async function walk({
14723
14759
  * console.log('oid', oid) // should be 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
14724
14760
  *
14725
14761
  */
14726
- async function writeBlob({ fs, dir, gitdir = path.join(dir, '.git'), blob }) {
14762
+ async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {
14727
14763
  try {
14728
14764
  assertParameter('fs', fs);
14729
14765
  assertParameter('gitdir', gitdir);
@@ -14785,7 +14821,7 @@ async function _writeCommit({ fs, gitdir, commit }) {
14785
14821
  async function writeCommit({
14786
14822
  fs,
14787
14823
  dir,
14788
- gitdir = path.join(dir, '.git'),
14824
+ gitdir = join(dir, '.git'),
14789
14825
  commit,
14790
14826
  }) {
14791
14827
  try {
@@ -14874,7 +14910,7 @@ async function writeCommit({
14874
14910
  async function writeObject({
14875
14911
  fs: _fs,
14876
14912
  dir,
14877
- gitdir = path.join(dir, '.git'),
14913
+ gitdir = join(dir, '.git'),
14878
14914
  type,
14879
14915
  object,
14880
14916
  format = 'parsed',
@@ -14956,7 +14992,7 @@ async function writeObject({
14956
14992
  async function writeRef({
14957
14993
  fs: _fs,
14958
14994
  dir,
14959
- gitdir = path.join(dir, '.git'),
14995
+ gitdir = join(dir, '.git'),
14960
14996
  ref,
14961
14997
  value,
14962
14998
  force = false,
@@ -15066,7 +15102,7 @@ async function _writeTag({ fs, gitdir, tag }) {
15066
15102
  * console.log('tag', oid)
15067
15103
  *
15068
15104
  */
15069
- async function writeTag({ fs, dir, gitdir = path.join(dir, '.git'), tag }) {
15105
+ async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {
15070
15106
  try {
15071
15107
  assertParameter('fs', fs);
15072
15108
  assertParameter('gitdir', gitdir);
@@ -15099,7 +15135,7 @@ async function writeTag({ fs, dir, gitdir = path.join(dir, '.git'), tag }) {
15099
15135
  * @see TreeEntry
15100
15136
  *
15101
15137
  */
15102
- async function writeTree({ fs, dir, gitdir = path.join(dir, '.git'), tree }) {
15138
+ async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {
15103
15139
  try {
15104
15140
  assertParameter('fs', fs);
15105
15141
  assertParameter('gitdir', gitdir);