isomorphic-git 1.37.2 → 1.37.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
@@ -77,7 +77,10 @@ git.clone({ fs, http, dir, url: 'https://github.com/isomorphic-git/lightning-fs'
77
77
  ```
78
78
 
79
79
  If you're using `isomorphic-git` in the browser, you'll need something that emulates the `fs` API.
80
- The easiest to setup and most performant library is [LightningFS](https://github.com/isomorphic-git/lightning-fs) which is written and maintained by the same author and is part of the `isomorphic-git` suite.
80
+ The easiest to setup and most performant library is [LightningFS](https://github.com/isomorphic-git/lightning-fs) which is written and maintained by the same author and is part of the `isomorphic-git` suite.
81
+
82
+ ⚠️ LightningFS may apply file operations out of order, which can lead to repository corruption if the process crashes. You can mitigate this by calling `fs.flush()` after Git operations.
83
+
81
84
  If LightningFS doesn't meet your requirements, isomorphic-git should also work with [ZenFS](https://github.com/zen-fs/core) and [Filer](https://github.com/filerjs/filer).
82
85
  Instead of `isomorphic-git/http/node` this time import `isomorphic-git/http/web`:
83
86
 
package/index.cjs CHANGED
@@ -5201,7 +5201,7 @@ function assertParameter(name, value) {
5201
5201
  /**
5202
5202
  * discoverGitdir
5203
5203
  *
5204
- * When processing git commands on a submodule determine
5204
+ * When processing git commands on a submodule or worktree, determine
5205
5205
  * the actual git directory based on the contents of the .git file.
5206
5206
  *
5207
5207
  * Otherwise (if sent a directory) return that directory as-is.
@@ -5218,6 +5218,11 @@ function assertParameter(name, value) {
5218
5218
  *
5219
5219
  */
5220
5220
 
5221
+ // Check if a path is absolute (Unix / or Windows drive letter like C:\ or C:/)
5222
+ function isAbsolute(filepath) {
5223
+ return filepath.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(filepath)
5224
+ }
5225
+
5221
5226
  async function discoverGitdir({ fsp, dotgit }) {
5222
5227
  assertParameter('fsp', fsp);
5223
5228
  assertParameter('dotgit', dotgit);
@@ -5232,6 +5237,10 @@ async function discoverGitdir({ fsp, dotgit }) {
5232
5237
  ._readFile(dotgit, 'utf8')
5233
5238
  .then(contents => contents.trimRight().substr(8))
5234
5239
  .then(submoduleGitdir => {
5240
+ // Worktrees use absolute gitdir paths; submodules use relative ones.
5241
+ if (isAbsolute(submoduleGitdir)) {
5242
+ return submoduleGitdir
5243
+ }
5235
5244
  const gitdir = join(dirname(dotgit), submoduleGitdir);
5236
5245
  return gitdir
5237
5246
  })
@@ -9295,8 +9304,8 @@ function filterCapabilities(server, client) {
9295
9304
 
9296
9305
  const pkg = {
9297
9306
  name: 'isomorphic-git',
9298
- version: '1.37.2',
9299
- agent: 'git/isomorphic-git@1.37.2',
9307
+ version: '1.37.3',
9308
+ agent: 'git/isomorphic-git@1.37.3',
9300
9309
  };
9301
9310
 
9302
9311
  class FIFO {
package/index.js CHANGED
@@ -5195,7 +5195,7 @@ function assertParameter(name, value) {
5195
5195
  /**
5196
5196
  * discoverGitdir
5197
5197
  *
5198
- * When processing git commands on a submodule determine
5198
+ * When processing git commands on a submodule or worktree, determine
5199
5199
  * the actual git directory based on the contents of the .git file.
5200
5200
  *
5201
5201
  * Otherwise (if sent a directory) return that directory as-is.
@@ -5212,6 +5212,11 @@ function assertParameter(name, value) {
5212
5212
  *
5213
5213
  */
5214
5214
 
5215
+ // Check if a path is absolute (Unix / or Windows drive letter like C:\ or C:/)
5216
+ function isAbsolute(filepath) {
5217
+ return filepath.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(filepath)
5218
+ }
5219
+
5215
5220
  async function discoverGitdir({ fsp, dotgit }) {
5216
5221
  assertParameter('fsp', fsp);
5217
5222
  assertParameter('dotgit', dotgit);
@@ -5226,6 +5231,10 @@ async function discoverGitdir({ fsp, dotgit }) {
5226
5231
  ._readFile(dotgit, 'utf8')
5227
5232
  .then(contents => contents.trimRight().substr(8))
5228
5233
  .then(submoduleGitdir => {
5234
+ // Worktrees use absolute gitdir paths; submodules use relative ones.
5235
+ if (isAbsolute(submoduleGitdir)) {
5236
+ return submoduleGitdir
5237
+ }
5229
5238
  const gitdir = join(dirname(dotgit), submoduleGitdir);
5230
5239
  return gitdir
5231
5240
  })
@@ -9289,8 +9298,8 @@ function filterCapabilities(server, client) {
9289
9298
 
9290
9299
  const pkg = {
9291
9300
  name: 'isomorphic-git',
9292
- version: '1.37.2',
9293
- agent: 'git/isomorphic-git@1.37.2',
9301
+ version: '1.37.3',
9302
+ agent: 'git/isomorphic-git@1.37.3',
9294
9303
  };
9295
9304
 
9296
9305
  class FIFO {