isomorphic-git 1.44.0 → 1.44.1

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
@@ -10056,8 +10056,8 @@ function filterCapabilities(server, client) {
10056
10056
 
10057
10057
  const pkg = {
10058
10058
  name: 'isomorphic-git',
10059
- version: '1.44.0',
10060
- agent: 'git/isomorphic-git@1.44.0',
10059
+ version: '1.44.1',
10060
+ agent: 'git/isomorphic-git@1.44.1',
10061
10061
  };
10062
10062
 
10063
10063
  class FIFO {
@@ -16969,7 +16969,16 @@ async function status({
16969
16969
 
16970
16970
  const H = treeOid !== null; // head
16971
16971
  const I = indexEntry !== null; // index
16972
- const W = stats !== null; // working dir
16972
+ // `lstat` resolves names case-insensitively on filesystems like macOS
16973
+ // and Windows, so `ReAdMe.Md` returns the stats of `README.md`. For a
16974
+ // filepath tracked under that exact name (H or I) the leniency is what
16975
+ // core.ignorecase wants: the working copy is found. For any other
16976
+ // filepath it fabricates a file that is not there, turning 'absent'
16977
+ // into '*added', so confirm every segment exists exactly as spelled by
16978
+ // listing each parent directory.
16979
+ const W =
16980
+ stats !== null &&
16981
+ (H || I || (await hasExactCasePath({ fs, dir, filepath })));
16973
16982
 
16974
16983
  const getWorkdirOid = async () => {
16975
16984
  if (I && !compareStats(indexEntry, stats)) {
@@ -17054,6 +17063,33 @@ async function status({
17054
17063
  }
17055
17064
  }
17056
17065
 
17066
+ // Walks `filepath` segment by segment under `dir`, requiring each name to
17067
+ // appear exactly as spelled in the parent directory's `readdir` listing.
17068
+ // Directory listings report the case actually stored on disk even when
17069
+ // `lstat` resolves names case-insensitively. Names are compared in Unicode
17070
+ // normal form, since macOS may list `é` decomposed when it was passed composed.
17071
+ async function hasExactCasePath({ fs, dir, filepath }) {
17072
+ const segments = filepath
17073
+ .replace(/\\/g, '/')
17074
+ .split('/')
17075
+ .filter(segment => segment !== '' && segment !== '.');
17076
+ let parent = dir;
17077
+ for (const segment of segments) {
17078
+ let entries;
17079
+ try {
17080
+ entries = await fs._readdir(parent);
17081
+ } catch (err) {
17082
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return false
17083
+ throw err
17084
+ }
17085
+ if (!entries.some(entry => entry.normalize() === segment.normalize())) {
17086
+ return false
17087
+ }
17088
+ parent = join(parent, segment);
17089
+ }
17090
+ return true
17091
+ }
17092
+
17057
17093
  async function getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path }) {
17058
17094
  if (typeof path === 'string') path = path.split('/');
17059
17095
  const dirname = path.shift();
package/index.js CHANGED
@@ -10043,8 +10043,8 @@ function filterCapabilities(server, client) {
10043
10043
 
10044
10044
  const pkg = {
10045
10045
  name: 'isomorphic-git',
10046
- version: '1.44.0',
10047
- agent: 'git/isomorphic-git@1.44.0',
10046
+ version: '1.44.1',
10047
+ agent: 'git/isomorphic-git@1.44.1',
10048
10048
  };
10049
10049
 
10050
10050
  class FIFO {
@@ -16956,7 +16956,16 @@ async function status({
16956
16956
 
16957
16957
  const H = treeOid !== null; // head
16958
16958
  const I = indexEntry !== null; // index
16959
- const W = stats !== null; // working dir
16959
+ // `lstat` resolves names case-insensitively on filesystems like macOS
16960
+ // and Windows, so `ReAdMe.Md` returns the stats of `README.md`. For a
16961
+ // filepath tracked under that exact name (H or I) the leniency is what
16962
+ // core.ignorecase wants: the working copy is found. For any other
16963
+ // filepath it fabricates a file that is not there, turning 'absent'
16964
+ // into '*added', so confirm every segment exists exactly as spelled by
16965
+ // listing each parent directory.
16966
+ const W =
16967
+ stats !== null &&
16968
+ (H || I || (await hasExactCasePath({ fs, dir, filepath })));
16960
16969
 
16961
16970
  const getWorkdirOid = async () => {
16962
16971
  if (I && !compareStats(indexEntry, stats)) {
@@ -17041,6 +17050,33 @@ async function status({
17041
17050
  }
17042
17051
  }
17043
17052
 
17053
+ // Walks `filepath` segment by segment under `dir`, requiring each name to
17054
+ // appear exactly as spelled in the parent directory's `readdir` listing.
17055
+ // Directory listings report the case actually stored on disk even when
17056
+ // `lstat` resolves names case-insensitively. Names are compared in Unicode
17057
+ // normal form, since macOS may list `é` decomposed when it was passed composed.
17058
+ async function hasExactCasePath({ fs, dir, filepath }) {
17059
+ const segments = filepath
17060
+ .replace(/\\/g, '/')
17061
+ .split('/')
17062
+ .filter(segment => segment !== '' && segment !== '.');
17063
+ let parent = dir;
17064
+ for (const segment of segments) {
17065
+ let entries;
17066
+ try {
17067
+ entries = await fs._readdir(parent);
17068
+ } catch (err) {
17069
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return false
17070
+ throw err
17071
+ }
17072
+ if (!entries.some(entry => entry.normalize() === segment.normalize())) {
17073
+ return false
17074
+ }
17075
+ parent = join(parent, segment);
17076
+ }
17077
+ return true
17078
+ }
17079
+
17044
17080
  async function getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path }) {
17045
17081
  if (typeof path === 'string') path = path.split('/');
17046
17082
  const dirname = path.shift();