isomorphic-git 1.42.2 → 1.42.4

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/index.cjs CHANGED
@@ -5755,14 +5755,17 @@ class GitIgnoreManager {
5755
5755
  });
5756
5756
  }
5757
5757
  let ignoredStatus = false;
5758
- for (const p of pairs) {
5758
+ for (const [index, p] of pairs.entries()) {
5759
5759
  let file;
5760
5760
  try {
5761
5761
  file = await fs.read(p.gitignore, 'utf8');
5762
5762
  } catch (err) {
5763
5763
  if (err.code === 'NOENT') continue
5764
5764
  }
5765
- const ign = ignore().add(excludes);
5765
+ const ign = ignore();
5766
+ // The patterns in .git/info/exclude are relative to the working directory,
5767
+ // so only the first pair, which holds the full filepath, can use them.
5768
+ if (index === 0) ign.add(excludes);
5766
5769
  ign.add(file);
5767
5770
  // If the parent directory is excluded, we are done.
5768
5771
  // "It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined."
@@ -6256,12 +6259,15 @@ async function _commit({
6256
6259
  gitdir,
6257
6260
  ref,
6258
6261
  });
6259
- refCommit = await _readCommit({ fs, gitdir, oid: refOid, cache: {} });
6260
6262
  } catch {
6261
6263
  // We assume that there's no commit and this is the initial commit
6262
6264
  initialCommit = true;
6263
6265
  }
6264
6266
 
6267
+ if (!initialCommit && (amend || disallowEmpty)) {
6268
+ refCommit = await _readCommit({ fs, gitdir, oid: refOid, cache });
6269
+ }
6270
+
6265
6271
  if (amend && initialCommit) {
6266
6272
  throw new NoCommitError(ref)
6267
6273
  }
@@ -9800,8 +9806,8 @@ function filterCapabilities(server, client) {
9800
9806
 
9801
9807
  const pkg = {
9802
9808
  name: 'isomorphic-git',
9803
- version: '1.42.2',
9804
- agent: 'git/isomorphic-git@1.42.2',
9809
+ version: '1.42.4',
9810
+ agent: 'git/isomorphic-git@1.42.4',
9805
9811
  };
9806
9812
 
9807
9813
  class FIFO {
package/index.js CHANGED
@@ -5742,14 +5742,17 @@ class GitIgnoreManager {
5742
5742
  });
5743
5743
  }
5744
5744
  let ignoredStatus = false;
5745
- for (const p of pairs) {
5745
+ for (const [index, p] of pairs.entries()) {
5746
5746
  let file;
5747
5747
  try {
5748
5748
  file = await fs.read(p.gitignore, 'utf8');
5749
5749
  } catch (err) {
5750
5750
  if (err.code === 'NOENT') continue
5751
5751
  }
5752
- const ign = ignore().add(excludes);
5752
+ const ign = ignore();
5753
+ // The patterns in .git/info/exclude are relative to the working directory,
5754
+ // so only the first pair, which holds the full filepath, can use them.
5755
+ if (index === 0) ign.add(excludes);
5753
5756
  ign.add(file);
5754
5757
  // If the parent directory is excluded, we are done.
5755
5758
  // "It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined."
@@ -6243,12 +6246,15 @@ async function _commit({
6243
6246
  gitdir,
6244
6247
  ref,
6245
6248
  });
6246
- refCommit = await _readCommit({ fs, gitdir, oid: refOid, cache: {} });
6247
6249
  } catch {
6248
6250
  // We assume that there's no commit and this is the initial commit
6249
6251
  initialCommit = true;
6250
6252
  }
6251
6253
 
6254
+ if (!initialCommit && (amend || disallowEmpty)) {
6255
+ refCommit = await _readCommit({ fs, gitdir, oid: refOid, cache });
6256
+ }
6257
+
6252
6258
  if (amend && initialCommit) {
6253
6259
  throw new NoCommitError(ref)
6254
6260
  }
@@ -9787,8 +9793,8 @@ function filterCapabilities(server, client) {
9787
9793
 
9788
9794
  const pkg = {
9789
9795
  name: 'isomorphic-git',
9790
- version: '1.42.2',
9791
- agent: 'git/isomorphic-git@1.42.2',
9796
+ version: '1.42.4',
9797
+ agent: 'git/isomorphic-git@1.42.4',
9792
9798
  };
9793
9799
 
9794
9800
  class FIFO {