isomorphic-git 1.36.1 → 1.36.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 CHANGED
@@ -248,7 +248,7 @@ npm install
248
248
  npm test
249
249
  ```
250
250
 
251
- The new relase happen automatically after every PR merge. We use [sematic release](https://github.com/semantic-release/semantic-release).
251
+ The new release happens automatically after every PR merge. We use [semantic release](https://github.com/semantic-release/semantic-release).
252
252
 
253
253
  Check out the [`CONTRIBUTING`](./CONTRIBUTING.md) document for more instructions.
254
254
 
@@ -410,6 +410,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
410
410
  <td align="center"><a href="https://github.com/anish3333"><img src="https://avatars.githubusercontent.com/u/128889867?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Anish Awasthi</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Tests">⚠️</a></td>
411
411
  <td align="center"><a href="https://github.com/fetsorn"><img src="https://avatars.githubusercontent.com/u/12858105?v=4?s=60" width="60px;" alt=""/><br /><sub><b>fetsorn</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=fetsorn" title="Documentation">📖</a></td>
412
412
  <td align="center"><a href="http://www.dreamingcat.me/"><img src="https://avatars.githubusercontent.com/u/7752883?v=4?s=60" width="60px;" alt=""/><br /><sub><b>xiaoboost</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=xiaoboost" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=xiaoboost" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=xiaoboost" title="Tests">⚠️</a></td>
413
+ <td align="center"><a href="https://github.com/Andarist"><img src="https://avatars.githubusercontent.com/u/9800850?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mateusz Burzyński</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=Andarist" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=Andarist" title="Tests">⚠️</a></td>
413
414
  </tr>
414
415
  </table>
415
416
 
package/index.cjs CHANGED
@@ -4513,9 +4513,14 @@ class GitWalkerFs {
4513
4513
  if ((await entry.type()) === 'tree') {
4514
4514
  entry._content = undefined;
4515
4515
  } else {
4516
- const config = await this._getGitConfig(fs, gitdir);
4517
- const autocrlf = await config.get('core.autocrlf');
4518
- const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4516
+ let content;
4517
+ if ((await entry.mode()) >> 12 === 0b1010) {
4518
+ content = await fs.readlink(`${dir}/${entry._fullpath}`);
4519
+ } else {
4520
+ const config = await this._getGitConfig(fs, gitdir);
4521
+ const autocrlf = await config.get('core.autocrlf');
4522
+ content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4523
+ }
4519
4524
  // workaround for a BrowserFS edge case
4520
4525
  entry._actualSize = content.length;
4521
4526
  if (entry._stat && entry._stat.size === -1) {
@@ -5812,7 +5817,10 @@ async function _commit({
5812
5817
  }) {
5813
5818
  // Determine ref and the commit pointed to by ref, and if it is the initial commit
5814
5819
  let initialCommit = false;
5820
+ let detachedHead = false;
5815
5821
  if (!ref) {
5822
+ const headContent = await fs.read(`${gitdir}/HEAD`, { encoding: 'utf8' });
5823
+ detachedHead = !headContent.startsWith('ref:');
5816
5824
  ref = await GitRefManager.resolve({
5817
5825
  fs,
5818
5826
  gitdir,
@@ -5918,11 +5926,11 @@ async function _commit({
5918
5926
  dryRun,
5919
5927
  });
5920
5928
  if (!noUpdateBranch && !dryRun) {
5921
- // Update branch pointer
5929
+ // Update branch pointer (or HEAD directly if detached)
5922
5930
  await GitRefManager.writeRef({
5923
5931
  fs,
5924
5932
  gitdir,
5925
- ref,
5933
+ ref: detachedHead ? 'HEAD' : ref,
5926
5934
  value: oid,
5927
5935
  });
5928
5936
  }
@@ -8256,8 +8264,8 @@ function filterCapabilities(server, client) {
8256
8264
 
8257
8265
  const pkg = {
8258
8266
  name: 'isomorphic-git',
8259
- version: '1.36.1',
8260
- agent: 'git/isomorphic-git@1.36.1',
8267
+ version: '1.36.3',
8268
+ agent: 'git/isomorphic-git@1.36.3',
8261
8269
  };
8262
8270
 
8263
8271
  class FIFO {
package/index.js CHANGED
@@ -4507,9 +4507,14 @@ class GitWalkerFs {
4507
4507
  if ((await entry.type()) === 'tree') {
4508
4508
  entry._content = undefined;
4509
4509
  } else {
4510
- const config = await this._getGitConfig(fs, gitdir);
4511
- const autocrlf = await config.get('core.autocrlf');
4512
- const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4510
+ let content;
4511
+ if ((await entry.mode()) >> 12 === 0b1010) {
4512
+ content = await fs.readlink(`${dir}/${entry._fullpath}`);
4513
+ } else {
4514
+ const config = await this._getGitConfig(fs, gitdir);
4515
+ const autocrlf = await config.get('core.autocrlf');
4516
+ content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4517
+ }
4513
4518
  // workaround for a BrowserFS edge case
4514
4519
  entry._actualSize = content.length;
4515
4520
  if (entry._stat && entry._stat.size === -1) {
@@ -5806,7 +5811,10 @@ async function _commit({
5806
5811
  }) {
5807
5812
  // Determine ref and the commit pointed to by ref, and if it is the initial commit
5808
5813
  let initialCommit = false;
5814
+ let detachedHead = false;
5809
5815
  if (!ref) {
5816
+ const headContent = await fs.read(`${gitdir}/HEAD`, { encoding: 'utf8' });
5817
+ detachedHead = !headContent.startsWith('ref:');
5810
5818
  ref = await GitRefManager.resolve({
5811
5819
  fs,
5812
5820
  gitdir,
@@ -5912,11 +5920,11 @@ async function _commit({
5912
5920
  dryRun,
5913
5921
  });
5914
5922
  if (!noUpdateBranch && !dryRun) {
5915
- // Update branch pointer
5923
+ // Update branch pointer (or HEAD directly if detached)
5916
5924
  await GitRefManager.writeRef({
5917
5925
  fs,
5918
5926
  gitdir,
5919
- ref,
5927
+ ref: detachedHead ? 'HEAD' : ref,
5920
5928
  value: oid,
5921
5929
  });
5922
5930
  }
@@ -8250,8 +8258,8 @@ function filterCapabilities(server, client) {
8250
8258
 
8251
8259
  const pkg = {
8252
8260
  name: 'isomorphic-git',
8253
- version: '1.36.1',
8254
- agent: 'git/isomorphic-git@1.36.1',
8261
+ version: '1.36.3',
8262
+ agent: 'git/isomorphic-git@1.36.3',
8255
8263
  };
8256
8264
 
8257
8265
  class FIFO {