isomorphic-git 1.19.2 โ†’ 1.21.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
 
@@ -2,7 +2,9 @@
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
3
  "Firefox 103.0 (Ubuntu 0.0.0)",
4
4
  "Edge 79.0.309.65 (Windows 10)",
5
- "Chrome 103.0.5060.53 (Android 10)",
5
+ "Mobile Safari 13.0 (iOS 13.0)",
6
+ "X Chrome 103.0.5060.53 (Android 10)",
6
7
  "Safari 13.1 (Mac OS 10.15.4)",
7
- "Mobile Safari 13.0 (iOS 13.0)"
8
+ "X Chrome 103.0.5060.53 (Android 10)",
9
+ "Chrome 103.0.5060.53 (Android 10)"
8
10
  ]
package/index.cjs CHANGED
@@ -5391,7 +5391,9 @@ async function annotatedTag({
5391
5391
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
5392
5392
  * @param {string} args.gitdir
5393
5393
  * @param {string} args.ref
5394
+ * @param {string} [args.object = 'HEAD']
5394
5395
  * @param {boolean} [args.checkout = false]
5396
+ * @param {boolean} [args.force = false]
5395
5397
  *
5396
5398
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5397
5399
  *
@@ -5400,22 +5402,31 @@ async function annotatedTag({
5400
5402
  * console.log('done')
5401
5403
  *
5402
5404
  */
5403
- async function _branch({ fs, gitdir, ref, checkout = false }) {
5405
+ async function _branch({
5406
+ fs,
5407
+ gitdir,
5408
+ ref,
5409
+ object,
5410
+ checkout = false,
5411
+ force = false,
5412
+ }) {
5404
5413
  if (ref !== cleanGitRef.clean(ref)) {
5405
5414
  throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
5406
5415
  }
5407
5416
 
5408
5417
  const fullref = `refs/heads/${ref}`;
5409
5418
 
5410
- const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref });
5411
- if (exist) {
5412
- throw new AlreadyExistsError('branch', ref, false)
5419
+ if (!force) {
5420
+ const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref });
5421
+ if (exist) {
5422
+ throw new AlreadyExistsError('branch', ref, false)
5423
+ }
5413
5424
  }
5414
5425
 
5415
5426
  // Get current HEAD tree oid
5416
5427
  let oid;
5417
5428
  try {
5418
- oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' });
5429
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' });
5419
5430
  } catch (e) {
5420
5431
  // Probably an empty repo
5421
5432
  }
@@ -5446,7 +5457,9 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5446
5457
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
5447
5458
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
5448
5459
  * @param {string} args.ref - What to name the branch
5460
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
5449
5461
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
5462
+ * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.
5450
5463
  *
5451
5464
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5452
5465
  *
@@ -5460,7 +5473,9 @@ async function branch({
5460
5473
  dir,
5461
5474
  gitdir = join(dir, '.git'),
5462
5475
  ref,
5476
+ object,
5463
5477
  checkout = false,
5478
+ force = false,
5464
5479
  }) {
5465
5480
  try {
5466
5481
  assertParameter('fs', fs);
@@ -5470,7 +5485,9 @@ async function branch({
5470
5485
  fs: new FileSystem(fs),
5471
5486
  gitdir,
5472
5487
  ref,
5488
+ object,
5473
5489
  checkout,
5490
+ force,
5474
5491
  })
5475
5492
  } catch (err) {
5476
5493
  err.caller = 'git.branch';
@@ -6990,8 +7007,8 @@ function filterCapabilities(server, client) {
6990
7007
 
6991
7008
  const pkg = {
6992
7009
  name: 'isomorphic-git',
6993
- version: '1.19.2',
6994
- agent: 'git/isomorphic-git@1.19.2',
7010
+ version: '1.21.0',
7011
+ agent: 'git/isomorphic-git@1.21.0',
6995
7012
  };
6996
7013
 
6997
7014
  class FIFO {
package/index.d.ts CHANGED
@@ -932,7 +932,9 @@ 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
937
+ * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.
936
938
  *
937
939
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
938
940
  *
@@ -941,12 +943,14 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
941
943
  * console.log('done')
942
944
  *
943
945
  */
944
- export function branch({ fs, dir, gitdir, ref, checkout, }: {
946
+ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
945
947
  fs: CallbackFsClient | PromiseFsClient;
946
948
  dir?: string;
947
949
  gitdir?: string;
948
950
  ref: string;
951
+ object?: string;
949
952
  checkout?: boolean;
953
+ force?: boolean;
950
954
  }): Promise<void>;
951
955
  /**
952
956
  * Checkout a branch
package/index.js CHANGED
@@ -5385,7 +5385,9 @@ async function annotatedTag({
5385
5385
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
5386
5386
  * @param {string} args.gitdir
5387
5387
  * @param {string} args.ref
5388
+ * @param {string} [args.object = 'HEAD']
5388
5389
  * @param {boolean} [args.checkout = false]
5390
+ * @param {boolean} [args.force = false]
5389
5391
  *
5390
5392
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5391
5393
  *
@@ -5394,22 +5396,31 @@ async function annotatedTag({
5394
5396
  * console.log('done')
5395
5397
  *
5396
5398
  */
5397
- async function _branch({ fs, gitdir, ref, checkout = false }) {
5399
+ async function _branch({
5400
+ fs,
5401
+ gitdir,
5402
+ ref,
5403
+ object,
5404
+ checkout = false,
5405
+ force = false,
5406
+ }) {
5398
5407
  if (ref !== cleanGitRef.clean(ref)) {
5399
5408
  throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))
5400
5409
  }
5401
5410
 
5402
5411
  const fullref = `refs/heads/${ref}`;
5403
5412
 
5404
- const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref });
5405
- if (exist) {
5406
- throw new AlreadyExistsError('branch', ref, false)
5413
+ if (!force) {
5414
+ const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref });
5415
+ if (exist) {
5416
+ throw new AlreadyExistsError('branch', ref, false)
5417
+ }
5407
5418
  }
5408
5419
 
5409
5420
  // Get current HEAD tree oid
5410
5421
  let oid;
5411
5422
  try {
5412
- oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' });
5423
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' });
5413
5424
  } catch (e) {
5414
5425
  // Probably an empty repo
5415
5426
  }
@@ -5440,7 +5451,9 @@ async function _branch({ fs, gitdir, ref, checkout = false }) {
5440
5451
  * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
5441
5452
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
5442
5453
  * @param {string} args.ref - What to name the branch
5454
+ * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.
5443
5455
  * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch
5456
+ * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.
5444
5457
  *
5445
5458
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5446
5459
  *
@@ -5454,7 +5467,9 @@ async function branch({
5454
5467
  dir,
5455
5468
  gitdir = join(dir, '.git'),
5456
5469
  ref,
5470
+ object,
5457
5471
  checkout = false,
5472
+ force = false,
5458
5473
  }) {
5459
5474
  try {
5460
5475
  assertParameter('fs', fs);
@@ -5464,7 +5479,9 @@ async function branch({
5464
5479
  fs: new FileSystem(fs),
5465
5480
  gitdir,
5466
5481
  ref,
5482
+ object,
5467
5483
  checkout,
5484
+ force,
5468
5485
  })
5469
5486
  } catch (err) {
5470
5487
  err.caller = 'git.branch';
@@ -6984,8 +7001,8 @@ function filterCapabilities(server, client) {
6984
7001
 
6985
7002
  const pkg = {
6986
7003
  name: 'isomorphic-git',
6987
- version: '1.19.2',
6988
- agent: 'git/isomorphic-git@1.19.2',
7004
+ version: '1.21.0',
7005
+ agent: 'git/isomorphic-git@1.21.0',
6989
7006
  };
6990
7007
 
6991
7008
  class FIFO {
@@ -932,7 +932,9 @@ 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
937
+ * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.
936
938
  *
937
939
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
938
940
  *
@@ -941,12 +943,14 @@ export function annotatedTag({ fs: _fs, onSign, dir, gitdir, ref, tagger: _tagge
941
943
  * console.log('done')
942
944
  *
943
945
  */
944
- export function branch({ fs, dir, gitdir, ref, checkout, }: {
946
+ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
945
947
  fs: CallbackFsClient | PromiseFsClient;
946
948
  dir?: string;
947
949
  gitdir?: string;
948
950
  ref: string;
951
+ object?: string;
949
952
  checkout?: boolean;
953
+ force?: boolean;
950
954
  }): Promise<void>;
951
955
  /**
952
956
  * Checkout a branch