isomorphic-git 1.10.2 → 1.11.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.
@@ -1,8 +1,8 @@
1
1
  [
2
2
  "HeadlessChrome 0.0.0 (Linux 0.0.0)",
3
- "Firefox 94.0.0 (Ubuntu 0.0.0)",
4
- "Safari 13.1.0 (Mac OS X 10.15.4)",
3
+ "Firefox 96.0.0 (Ubuntu 0.0.0)",
4
+ "Chrome Mobile 96.0.4664 (Android 0.0.0)",
5
5
  "Chrome 79.0.3945 (Windows 10 0.0.0)",
6
- "Mobile Safari 13.0.0 (iOS 13.0.0)",
7
- "Chrome Mobile 94.0.4606 (Android 0.0.0)"
6
+ "Safari 13.1.0 (Mac OS X 10.15.4)",
7
+ "Mobile Safari 13.0.0 (iOS 13.0.0)"
8
8
  ]
package/index.cjs CHANGED
@@ -1559,16 +1559,16 @@ class GitConfig {
1559
1559
  this.parsedConfig[configIndex] = modifiedConfig;
1560
1560
  }
1561
1561
  } else {
1562
- const sectionPath = path
1563
- .split('.')
1564
- .slice(0, -1)
1565
- .join('.')
1566
- .toLowerCase();
1562
+ const pathSegments = path.split('.');
1563
+ const section = pathSegments.shift().toLowerCase();
1564
+ const name = pathSegments.pop();
1565
+ const subsection = pathSegments.length
1566
+ ? pathSegments.join('.').toLowerCase()
1567
+ : undefined;
1568
+ const sectionPath = subsection ? section + '.' + subsection : section;
1567
1569
  const sectionIndex = this.parsedConfig.findIndex(
1568
1570
  config => config.path === sectionPath
1569
1571
  );
1570
- const [section, subsection] = sectionPath.split('.');
1571
- const name = path.split('.').pop();
1572
1572
  const newConfig = {
1573
1573
  section,
1574
1574
  subsection,
@@ -3976,7 +3976,15 @@ class GitWalkerFs {
3976
3976
  oid = await shasum(
3977
3977
  GitObject.wrap({ type: 'blob', object: await entry.content() })
3978
3978
  );
3979
- if (stage && oid === stage.oid) {
3979
+ // Update the stats in the index so we will get a "cache hit" next time
3980
+ // 1) if we can (because the oid and mode are the same)
3981
+ // 2) and only if we need to (because other stats differ)
3982
+ if (
3983
+ stage &&
3984
+ oid === stage.oid &&
3985
+ stats.mode === stage.mode &&
3986
+ compareStats(stats, stage)
3987
+ ) {
3980
3988
  index.insert({
3981
3989
  filepath: entry._fullpath,
3982
3990
  stats,
@@ -4034,7 +4042,7 @@ class GitIgnoreManager {
4034
4042
  filepath,
4035
4043
  },
4036
4044
  ];
4037
- const pieces = filepath.split('/');
4045
+ const pieces = filepath.split('/').filter(Boolean);
4038
4046
  for (let i = 1; i < pieces.length; i++) {
4039
4047
  const folder = pieces.slice(0, i).join('/');
4040
4048
  const file = pieces.slice(i).join('/');
@@ -5543,6 +5551,7 @@ const worthWalking = (filepath, root) => {
5543
5551
  * @param {boolean} [args.noUpdateHead]
5544
5552
  * @param {boolean} [args.dryRun]
5545
5553
  * @param {boolean} [args.force]
5554
+ * @param {boolean} [args.track]
5546
5555
  *
5547
5556
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5548
5557
  *
@@ -5560,6 +5569,7 @@ async function _checkout({
5560
5569
  noUpdateHead,
5561
5570
  dryRun,
5562
5571
  force,
5572
+ track,
5563
5573
  }) {
5564
5574
  // Get tree oid
5565
5575
  let oid;
@@ -5577,11 +5587,13 @@ async function _checkout({
5577
5587
  gitdir,
5578
5588
  ref: remoteRef,
5579
5589
  });
5580
- // Set up remote tracking branch
5581
- const config = await GitConfigManager.get({ fs, gitdir });
5582
- await config.set(`branch.${ref}.remote`, remote);
5583
- await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5584
- await GitConfigManager.save({ fs, gitdir, config });
5590
+ if (track) {
5591
+ // Set up remote tracking branch
5592
+ const config = await GitConfigManager.get({ fs, gitdir });
5593
+ await config.set(`branch.${ref}.remote`, remote);
5594
+ await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5595
+ await GitConfigManager.save({ fs, gitdir, config });
5596
+ }
5585
5597
  // Create a new branch that points at that same commit
5586
5598
  await GitRefManager.writeRef({
5587
5599
  fs,
@@ -6107,6 +6119,7 @@ async function analyze({
6107
6119
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
6108
6120
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
6109
6121
  * @param {object} [args.cache] - a [cache](cache.md) object
6122
+ * @param {object} [args.track] - If true, will not set the remote branch tracking information. Defaults to false.
6110
6123
  *
6111
6124
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
6112
6125
  *
@@ -6154,6 +6167,7 @@ async function checkout({
6154
6167
  dryRun = false,
6155
6168
  force = false,
6156
6169
  cache = {},
6170
+ track = true,
6157
6171
  }) {
6158
6172
  try {
6159
6173
  assertParameter('fs', fs);
@@ -6174,6 +6188,7 @@ async function checkout({
6174
6188
  noUpdateHead,
6175
6189
  dryRun,
6176
6190
  force,
6191
+ track,
6177
6192
  })
6178
6193
  } catch (err) {
6179
6194
  err.caller = 'git.checkout';
@@ -6857,8 +6872,8 @@ function filterCapabilities(server, client) {
6857
6872
 
6858
6873
  const pkg = {
6859
6874
  name: 'isomorphic-git',
6860
- version: '1.10.2',
6861
- agent: 'git/isomorphic-git@1.10.2',
6875
+ version: '1.11.0',
6876
+ agent: 'git/isomorphic-git@1.11.0',
6862
6877
  };
6863
6878
 
6864
6879
  class FIFO {
package/index.d.ts CHANGED
@@ -945,6 +945,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
945
945
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
946
946
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
947
947
  * @param {object} [args.cache] - a [cache](cache.md) object
948
+ * @param {object} [args.track] - If true, will not set the remote branch tracking information. Defaults to false.
948
949
  *
949
950
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
950
951
  *
@@ -979,7 +980,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
979
980
  * })
980
981
  * console.log('done')
981
982
  */
982
- export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, }: {
983
+ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, track, }: {
983
984
  fs: CallbackFsClient | PromiseFsClient;
984
985
  onProgress?: ProgressCallback;
985
986
  dir: string;
@@ -992,6 +993,7 @@ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filep
992
993
  dryRun?: boolean;
993
994
  force?: boolean;
994
995
  cache?: any;
996
+ track?: any;
995
997
  }): Promise<void>;
996
998
  /**
997
999
  * Clone a repository
package/index.js CHANGED
@@ -1553,16 +1553,16 @@ class GitConfig {
1553
1553
  this.parsedConfig[configIndex] = modifiedConfig;
1554
1554
  }
1555
1555
  } else {
1556
- const sectionPath = path
1557
- .split('.')
1558
- .slice(0, -1)
1559
- .join('.')
1560
- .toLowerCase();
1556
+ const pathSegments = path.split('.');
1557
+ const section = pathSegments.shift().toLowerCase();
1558
+ const name = pathSegments.pop();
1559
+ const subsection = pathSegments.length
1560
+ ? pathSegments.join('.').toLowerCase()
1561
+ : undefined;
1562
+ const sectionPath = subsection ? section + '.' + subsection : section;
1561
1563
  const sectionIndex = this.parsedConfig.findIndex(
1562
1564
  config => config.path === sectionPath
1563
1565
  );
1564
- const [section, subsection] = sectionPath.split('.');
1565
- const name = path.split('.').pop();
1566
1566
  const newConfig = {
1567
1567
  section,
1568
1568
  subsection,
@@ -3970,7 +3970,15 @@ class GitWalkerFs {
3970
3970
  oid = await shasum(
3971
3971
  GitObject.wrap({ type: 'blob', object: await entry.content() })
3972
3972
  );
3973
- if (stage && oid === stage.oid) {
3973
+ // Update the stats in the index so we will get a "cache hit" next time
3974
+ // 1) if we can (because the oid and mode are the same)
3975
+ // 2) and only if we need to (because other stats differ)
3976
+ if (
3977
+ stage &&
3978
+ oid === stage.oid &&
3979
+ stats.mode === stage.mode &&
3980
+ compareStats(stats, stage)
3981
+ ) {
3974
3982
  index.insert({
3975
3983
  filepath: entry._fullpath,
3976
3984
  stats,
@@ -4028,7 +4036,7 @@ class GitIgnoreManager {
4028
4036
  filepath,
4029
4037
  },
4030
4038
  ];
4031
- const pieces = filepath.split('/');
4039
+ const pieces = filepath.split('/').filter(Boolean);
4032
4040
  for (let i = 1; i < pieces.length; i++) {
4033
4041
  const folder = pieces.slice(0, i).join('/');
4034
4042
  const file = pieces.slice(i).join('/');
@@ -5537,6 +5545,7 @@ const worthWalking = (filepath, root) => {
5537
5545
  * @param {boolean} [args.noUpdateHead]
5538
5546
  * @param {boolean} [args.dryRun]
5539
5547
  * @param {boolean} [args.force]
5548
+ * @param {boolean} [args.track]
5540
5549
  *
5541
5550
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5542
5551
  *
@@ -5554,6 +5563,7 @@ async function _checkout({
5554
5563
  noUpdateHead,
5555
5564
  dryRun,
5556
5565
  force,
5566
+ track,
5557
5567
  }) {
5558
5568
  // Get tree oid
5559
5569
  let oid;
@@ -5571,11 +5581,13 @@ async function _checkout({
5571
5581
  gitdir,
5572
5582
  ref: remoteRef,
5573
5583
  });
5574
- // Set up remote tracking branch
5575
- const config = await GitConfigManager.get({ fs, gitdir });
5576
- await config.set(`branch.${ref}.remote`, remote);
5577
- await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5578
- await GitConfigManager.save({ fs, gitdir, config });
5584
+ if (track) {
5585
+ // Set up remote tracking branch
5586
+ const config = await GitConfigManager.get({ fs, gitdir });
5587
+ await config.set(`branch.${ref}.remote`, remote);
5588
+ await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5589
+ await GitConfigManager.save({ fs, gitdir, config });
5590
+ }
5579
5591
  // Create a new branch that points at that same commit
5580
5592
  await GitRefManager.writeRef({
5581
5593
  fs,
@@ -6101,6 +6113,7 @@ async function analyze({
6101
6113
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
6102
6114
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
6103
6115
  * @param {object} [args.cache] - a [cache](cache.md) object
6116
+ * @param {object} [args.track] - If true, will not set the remote branch tracking information. Defaults to false.
6104
6117
  *
6105
6118
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
6106
6119
  *
@@ -6148,6 +6161,7 @@ async function checkout({
6148
6161
  dryRun = false,
6149
6162
  force = false,
6150
6163
  cache = {},
6164
+ track = true,
6151
6165
  }) {
6152
6166
  try {
6153
6167
  assertParameter('fs', fs);
@@ -6168,6 +6182,7 @@ async function checkout({
6168
6182
  noUpdateHead,
6169
6183
  dryRun,
6170
6184
  force,
6185
+ track,
6171
6186
  })
6172
6187
  } catch (err) {
6173
6188
  err.caller = 'git.checkout';
@@ -6851,8 +6866,8 @@ function filterCapabilities(server, client) {
6851
6866
 
6852
6867
  const pkg = {
6853
6868
  name: 'isomorphic-git',
6854
- version: '1.10.2',
6855
- agent: 'git/isomorphic-git@1.10.2',
6869
+ version: '1.11.0',
6870
+ agent: 'git/isomorphic-git@1.11.0',
6856
6871
  };
6857
6872
 
6858
6873
  class FIFO {
@@ -945,6 +945,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
945
945
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
946
946
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
947
947
  * @param {object} [args.cache] - a [cache](cache.md) object
948
+ * @param {object} [args.track] - If true, will not set the remote branch tracking information. Defaults to false.
948
949
  *
949
950
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
950
951
  *
@@ -979,7 +980,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
979
980
  * })
980
981
  * console.log('done')
981
982
  */
982
- export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, }: {
983
+ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, track, }: {
983
984
  fs: CallbackFsClient | PromiseFsClient;
984
985
  onProgress?: ProgressCallback;
985
986
  dir: string;
@@ -992,6 +993,7 @@ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filep
992
993
  dryRun?: boolean;
993
994
  force?: boolean;
994
995
  cache?: any;
996
+ track?: any;
995
997
  }): Promise<void>;
996
998
  /**
997
999
  * Clone a repository