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.
@@ -886,14 +886,17 @@ class GitIgnoreManager {
886
886
  });
887
887
  }
888
888
  let ignoredStatus = false;
889
- for (const p of pairs) {
889
+ for (const [index, p] of pairs.entries()) {
890
890
  let file;
891
891
  try {
892
892
  file = await fs.read(p.gitignore, 'utf8');
893
893
  } catch (err) {
894
894
  if (err.code === 'NOENT') continue
895
895
  }
896
- const ign = ignore().add(excludes);
896
+ const ign = ignore();
897
+ // The patterns in .git/info/exclude are relative to the working directory,
898
+ // so only the first pair, which holds the full filepath, can use them.
899
+ if (index === 0) ign.add(excludes);
897
900
  ign.add(file);
898
901
  // If the parent directory is excluded, we are done.
899
902
  // "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."
package/managers/index.js CHANGED
@@ -879,14 +879,17 @@ class GitIgnoreManager {
879
879
  });
880
880
  }
881
881
  let ignoredStatus = false;
882
- for (const p of pairs) {
882
+ for (const [index, p] of pairs.entries()) {
883
883
  let file;
884
884
  try {
885
885
  file = await fs.read(p.gitignore, 'utf8');
886
886
  } catch (err) {
887
887
  if (err.code === 'NOENT') continue
888
888
  }
889
- const ign = ignore().add(excludes);
889
+ const ign = ignore();
890
+ // The patterns in .git/info/exclude are relative to the working directory,
891
+ // so only the first pair, which holds the full filepath, can use them.
892
+ if (index === 0) ign.add(excludes);
890
893
  ign.add(file);
891
894
  // If the parent directory is excluded, we are done.
892
895
  // "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."