isomorphic-git 1.19.1 โ†’ 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -347,6 +347,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
347
347
  <td align="center"><a href="https://github.com/seanpoulter"><img src="https://avatars.githubusercontent.com/u/2585460?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sean Poulter</b></sub></a><br /><a href="#maintenance-seanpoulter" title="Maintenance">๐Ÿšง</a></td>
348
348
  <td align="center"><a href="https://github.com/araknast"><img src="https://avatars.githubusercontent.com/u/84164531?v=4?s=60" width="60px;" alt=""/><br /><sub><b>araknast</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=araknast" title="Code">๐Ÿ’ป</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=araknast" title="Tests">โš ๏ธ</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=araknast" title="Documentation">๐Ÿ“–</a></td>
349
349
  <td align="center"><a href="https://github.com/rraab-dev"><img src="https://avatars.githubusercontent.com/u/53948988?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Rafael Raab</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=rraab-dev" title="Code">๐Ÿ’ป</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=rraab-dev" title="Documentation">๐Ÿ“–</a></td>
350
+ <td align="center"><a href="https://gitlab.com/CoalZombik/"><img src="https://avatars.githubusercontent.com/u/49895741?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Lukรกลก Cezner</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3ACoalZombik" title="Bug reports">๐Ÿ›</a></td>
350
351
  </tr>
351
352
  </table>
352
353
 
@@ -1,8 +1,8 @@
1
1
  [
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
- "Firefox 102.0 (Ubuntu 0.0.0)",
4
- "Chrome 100.0.4896.127 (Android 10)",
5
- "Mobile Safari 13.0 (iOS 13.0)",
3
+ "Firefox 103.0 (Ubuntu 0.0.0)",
4
+ "Chrome 103.0.5060.53 (Android 10)",
6
5
  "Edge 79.0.309.65 (Windows 10)",
7
- "Safari 13.1 (Mac OS 10.15.4)"
6
+ "Safari 13.1 (Mac OS 10.15.4)",
7
+ "Mobile Safari 13.0 (iOS 13.0)"
8
8
  ]
package/index.cjs CHANGED
@@ -3919,7 +3919,7 @@ class GitWalkerRepo {
3919
3919
  * @param {string} [args.ref='HEAD']
3920
3920
  * @returns {Walker}
3921
3921
  */
3922
- function TREE({ ref = 'HEAD' }) {
3922
+ function TREE({ ref = 'HEAD' } = {}) {
3923
3923
  const o = Object.create(null);
3924
3924
  Object.defineProperty(o, GitWalkSymbol, {
3925
3925
  value: function({ fs, gitdir, cache }) {
@@ -4489,6 +4489,12 @@ function assertParameter(name, value) {
4489
4489
  }
4490
4490
  }
4491
4491
 
4492
+ function posixifyPathBuffer(buffer) {
4493
+ let idx;
4494
+ while (~(idx = buffer.indexOf(92))) buffer[idx] = 47;
4495
+ return buffer
4496
+ }
4497
+
4492
4498
  // @ts-check
4493
4499
 
4494
4500
  /**
@@ -4565,7 +4571,7 @@ async function addToIndex({ dir, gitdir, fs, filepath, index, force }) {
4565
4571
  await Promise.all(promises);
4566
4572
  } else {
4567
4573
  const object = stats.isSymbolicLink()
4568
- ? await fs.readlink(join(dir, currentFilepath))
4574
+ ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
4569
4575
  : await fs.read(join(dir, currentFilepath));
4570
4576
  if (object === null) throw new NotFoundError(currentFilepath)
4571
4577
  const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
@@ -5385,6 +5391,7 @@ async function annotatedTag({
5385
5391
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
5386
5392
  * @param {string} args.gitdir
5387
5393
  * @param {string} args.ref
5394
+ * @param {string} [args.object = 'HEAD']
5388
5395
  * @param {boolean} [args.checkout = false]
5389
5396
  *
5390
5397
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -5394,7 +5401,7 @@ async function annotatedTag({
5394
5401
  * console.log('done')
5395
5402
  *
5396
5403
  */
5397
- async function _branch({ fs, gitdir, ref, checkout = false }) {
5404
+ async function _branch({ fs, gitdir, ref, object, checkout = false }) {
5398
5405
  if (ref !== cleanGitRef.clean(ref)) {
5399
5406
  throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
5400
5407
  }
@@ -5409,7 +5416,7 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5409
5416
  // Get current HEAD tree oid
5410
5417
  let oid;
5411
5418
  try {
5412
- oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' });
5419
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' });
5413
5420
  } catch (e) {
5414
5421
  // Probably an empty repo
5415
5422
  }
@@ -5440,6 +5447,7 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5440
5447
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
5441
5448
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
5442
5449
  * @param {string} args.ref - What to name the branch
5450
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
5443
5451
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
5444
5452
  *
5445
5453
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -5454,6 +5462,7 @@ async function branch({
5454
5462
  dir,
5455
5463
  gitdir = join(dir, '.git'),
5456
5464
  ref,
5465
+ object,
5457
5466
  checkout = false,
5458
5467
  }) {
5459
5468
  try {
@@ -5464,6 +5473,7 @@ async function branch({
5464
5473
  fs: new FileSystem(fs),
5465
5474
  gitdir,
5466
5475
  ref,
5476
+ object,
5467
5477
  checkout,
5468
5478
  })
5469
5479
  } catch (err) {
@@ -6984,8 +6994,8 @@ function filterCapabilities(server, client) {
6984
6994
 
6985
6995
  const pkg = {
6986
6996
  name: 'isomorphic-git',
6987
- version: '1.19.1',
6988
- agent: 'git/isomorphic-git@1.19.1',
6997
+ version: '1.20.0',
6998
+ agent: 'git/isomorphic-git@1.20.0',
6989
6999
  };
6990
7000
 
6991
7001
  class FIFO {
@@ -11813,6 +11823,7 @@ async function _push({
11813
11823
  }
11814
11824
  }
11815
11825
 
11826
+ if (oid === oldoid) force = true;
11816
11827
  if (!force) {
11817
11828
  // Is it a tag that already exists?
11818
11829
  if (
@@ -14032,12 +14043,14 @@ function version() {
14032
14043
  *
14033
14044
  * Example 2: Return the difference between the working directory and the HEAD commit
14034
14045
  * ```js
14035
- * const diff = require('diff-lines')
14036
- * async function map(filepath, [head, workdir]) {
14046
+ * const map = async (filepath, [head, workdir]) => {
14037
14047
  * return {
14038
14048
  * filepath,
14039
- * oid: await head.oid(),
14040
- * diff: diff((await head.content()).toString('utf8'), (await workdir.content()).toString('utf8'))
14049
+ * oid: await head?.oid(),
14050
+ * diff: diff(
14051
+ * (await head?.content())?.toString('utf8') || '',
14052
+ * (await workdir?.content())?.toString('utf8') || ''
14053
+ * )
14041
14054
  * }
14042
14055
  * }
14043
14056
  * ```
package/index.d.ts CHANGED
@@ -752,7 +752,7 @@ export function STAGE(): Walker;
752
752
  * @param {string} [args.ref='HEAD']
753
753
  * @returns {Walker}
754
754
  */
755
- export function TREE({ ref }: {
755
+ export function TREE({ ref }?: {
756
756
  ref?: string;
757
757
  }): Walker;
758
758
  /**
@@ -932,6 +932,7 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
932
932
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
933
933
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
934
934
  * @param {string} args.ref - What to name the branch
935
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
935
936
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
936
937
  *
937
938
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -941,11 +942,12 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
941
942
  * console.log('done')
942
943
  *
943
944
  */
944
- export function branch({ fs, dir, gitdir, ref, checkout, }: {
945
+ export function branch({ fs, dir, gitdir, ref, object, checkout, }: {
945
946
  fs: CallbackFsClient | PromiseFsClient;
946
947
  dir?: string;
947
948
  gitdir?: string;
948
949
  ref: string;
950
+ object?: string;
949
951
  checkout?: boolean;
950
952
  }): Promise<void>;
951
953
  /**
@@ -3415,12 +3417,14 @@ export function version(): string;
3415
3417
  *
3416
3418
  * Example 2: Return the difference between the working directory and the HEAD commit
3417
3419
  * ```js
3418
- * const diff = require('diff-lines')
3419
- * async function map(filepath, [head, workdir]) {
3420
+ * const map = async (filepath, [head, workdir]) => {
3420
3421
  * return {
3421
3422
  * filepath,
3422
- * oid: await head.oid(),
3423
- * diff: diff((await head.content()).toString('utf8'), (await workdir.content()).toString('utf8'))
3423
+ * oid: await head?.oid(),
3424
+ * diff: diff(
3425
+ * (await head?.content())?.toString('utf8') || '',
3426
+ * (await workdir?.content())?.toString('utf8') || ''
3427
+ * )
3424
3428
  * }
3425
3429
  * }
3426
3430
  * ```
package/index.js CHANGED
@@ -3913,7 +3913,7 @@ class GitWalkerRepo {
3913
3913
  * @param {string} [args.ref='HEAD']
3914
3914
  * @returns {Walker}
3915
3915
  */
3916
- function TREE({ ref = 'HEAD' }) {
3916
+ function TREE({ ref = 'HEAD' } = {}) {
3917
3917
  const o = Object.create(null);
3918
3918
  Object.defineProperty(o, GitWalkSymbol, {
3919
3919
  value: function({ fs, gitdir, cache }) {
@@ -4483,6 +4483,12 @@ function assertParameter(name, value) {
4483
4483
  }
4484
4484
  }
4485
4485
 
4486
+ function posixifyPathBuffer(buffer) {
4487
+ let idx;
4488
+ while (~(idx = buffer.indexOf(92))) buffer[idx] = 47;
4489
+ return buffer
4490
+ }
4491
+
4486
4492
  // @ts-check
4487
4493
 
4488
4494
  /**
@@ -4559,7 +4565,7 @@ async function addToIndex({ dir, gitdir, fs, filepath, index, force }) {
4559
4565
  await Promise.all(promises);
4560
4566
  } else {
4561
4567
  const object = stats.isSymbolicLink()
4562
- ? await fs.readlink(join(dir, currentFilepath))
4568
+ ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
4563
4569
  : await fs.read(join(dir, currentFilepath));
4564
4570
  if (object === null) throw new NotFoundError(currentFilepath)
4565
4571
  const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
@@ -5379,6 +5385,7 @@ async function annotatedTag({
5379
5385
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
5380
5386
  * @param {string} args.gitdir
5381
5387
  * @param {string} args.ref
5388
+ * @param {string} [args.object = 'HEAD']
5382
5389
  * @param {boolean} [args.checkout = false]
5383
5390
  *
5384
5391
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -5388,7 +5395,7 @@ async function annotatedTag({
5388
5395
  * console.log('done')
5389
5396
  *
5390
5397
  */
5391
- async function _branch({ fs, gitdir, ref, checkout = false }) {
5398
+ async function _branch({ fs, gitdir, ref, object, checkout = false }) {
5392
5399
  if (ref !== cleanGitRef.clean(ref)) {
5393
5400
  throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
5394
5401
  }
@@ -5403,7 +5410,7 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5403
5410
  // Get current HEAD tree oid
5404
5411
  let oid;
5405
5412
  try {
5406
- oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' });
5413
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' });
5407
5414
  } catch (e) {
5408
5415
  // Probably an empty repo
5409
5416
  }
@@ -5434,6 +5441,7 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5434
5441
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
5435
5442
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
5436
5443
  * @param {string} args.ref - What to name the branch
5444
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
5437
5445
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
5438
5446
  *
5439
5447
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -5448,6 +5456,7 @@ async function branch({
5448
5456
  dir,
5449
5457
  gitdir = join(dir, '.git'),
5450
5458
  ref,
5459
+ object,
5451
5460
  checkout = false,
5452
5461
  }) {
5453
5462
  try {
@@ -5458,6 +5467,7 @@ async function branch({
5458
5467
  fs: new FileSystem(fs),
5459
5468
  gitdir,
5460
5469
  ref,
5470
+ object,
5461
5471
  checkout,
5462
5472
  })
5463
5473
  } catch (err) {
@@ -6978,8 +6988,8 @@ function filterCapabilities(server, client) {
6978
6988
 
6979
6989
  const pkg = {
6980
6990
  name: 'isomorphic-git',
6981
- version: '1.19.1',
6982
- agent: 'git/isomorphic-git@1.19.1',
6991
+ version: '1.20.0',
6992
+ agent: 'git/isomorphic-git@1.20.0',
6983
6993
  };
6984
6994
 
6985
6995
  class FIFO {
@@ -11807,6 +11817,7 @@ async function _push({
11807
11817
  }
11808
11818
  }
11809
11819
 
11820
+ if (oid === oldoid) force = true;
11810
11821
  if (!force) {
11811
11822
  // Is it a tag that already exists?
11812
11823
  if (
@@ -14026,12 +14037,14 @@ function version() {
14026
14037
  *
14027
14038
  * Example 2: Return the difference between the working directory and the HEAD commit
14028
14039
  * ```js
14029
- * const diff = require('diff-lines')
14030
- * async function map(filepath, [head, workdir]) {
14040
+ * const map = async (filepath, [head, workdir]) => {
14031
14041
  * return {
14032
14042
  * filepath,
14033
- * oid: await head.oid(),
14034
- * diff: diff((await head.content()).toString('utf8'), (await workdir.content()).toString('utf8'))
14043
+ * oid: await head?.oid(),
14044
+ * diff: diff(
14045
+ * (await head?.content())?.toString('utf8') || '',
14046
+ * (await workdir?.content())?.toString('utf8') || ''
14047
+ * )
14035
14048
  * }
14036
14049
  * }
14037
14050
  * ```
@@ -752,7 +752,7 @@ export function STAGE(): Walker;
752
752
  * @param {string} [args.ref='HEAD']
753
753
  * @returns {Walker}
754
754
  */
755
- export function TREE({ ref }: {
755
+ export function TREE({ ref }?: {
756
756
  ref?: string;
757
757
  }): Walker;
758
758
  /**
@@ -932,6 +932,7 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
932
932
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
933
933
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
934
934
  * @param {string} args.ref - What to name the branch
935
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
935
936
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
936
937
  *
937
938
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -941,11 +942,12 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
941
942
  * console.log('done')
942
943
  *
943
944
  */
944
- export function branch({ fs, dir, gitdir, ref, checkout, }: {
945
+ export function branch({ fs, dir, gitdir, ref, object, checkout, }: {
945
946
  fs: CallbackFsClient | PromiseFsClient;
946
947
  dir?: string;
947
948
  gitdir?: string;
948
949
  ref: string;
950
+ object?: string;
949
951
  checkout?: boolean;
950
952
  }): Promise<void>;
951
953
  /**
@@ -3415,12 +3417,14 @@ export function version(): string;
3415
3417
  *
3416
3418
  * Example 2: Return the difference between the working directory and the HEAD commit
3417
3419
  * ```js
3418
- * const diff = require('diff-lines')
3419
- * async function map(filepath, [head, workdir]) {
3420
+ * const map = async (filepath, [head, workdir]) => {
3420
3421
  * return {
3421
3422
  * filepath,
3422
- * oid: await head.oid(),
3423
- * diff: diff((await head.content()).toString('utf8'), (await workdir.content()).toString('utf8'))
3423
+ * oid: await head?.oid(),
3424
+ * diff: diff(
3425
+ * (await head?.content())?.toString('utf8') || '',
3426
+ * (await workdir?.content())?.toString('utf8') || ''
3427
+ * )
3424
3428
  * }
3425
3429
  * }
3426
3430
  * ```