isomorphic-git 1.43.3 → 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/README.md CHANGED
@@ -462,6 +462,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
462
462
  <tr>
463
463
  <td align="center"><a href="https://github.com/ewraj"><img src="https://avatars.githubusercontent.com/u/212665522?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Raj Royal</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ewraj" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ewraj" title="Tests">⚠️</a></td>
464
464
  <td align="center"><a href="https://github.com/macabeus"><img src="https://avatars.githubusercontent.com/u/9501115?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Bruno Macabeus</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=macabeus" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=macabeus" title="Tests">⚠️</a></td>
465
+ <td align="center"><a href="https://github.com/ShahabAhmed01"><img src="https://avatars.githubusercontent.com/u/192491541?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Shahab Ahmed</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Tests">⚠️</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Documentation">📖</a></td>
465
466
  </tr>
466
467
  </table>
467
468
 
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.43.3',
10060
- agent: 'git/isomorphic-git@1.43.3',
10059
+ version: '1.44.1',
10060
+ agent: 'git/isomorphic-git@1.44.1',
10061
10061
  };
10062
10062
 
10063
10063
  class FIFO {
@@ -13673,6 +13673,7 @@ async function _resolveFileId({
13673
13673
  * @param {string=} args.filepath optional get the commit for the filepath only
13674
13674
  * @param {string} args.ref
13675
13675
  * @param {number|void} args.depth
13676
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string
13676
13677
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13677
13678
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13678
13679
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit.
@@ -13694,6 +13695,7 @@ async function _log({
13694
13695
  ref,
13695
13696
  depth,
13696
13697
  since,
13698
+ author,
13697
13699
  force,
13698
13700
  follow,
13699
13701
  includeChanges,
@@ -13702,9 +13704,26 @@ async function _log({
13702
13704
  typeof since === 'undefined'
13703
13705
  ? undefined
13704
13706
  : Math.floor(since.valueOf() / 1000);
13707
+ // The pattern is a case-insensitive JavaScript regular expression that is
13708
+ // matched against the author's "Name <email>" string.
13709
+ const authorRegex =
13710
+ author === undefined || author === null
13711
+ ? undefined
13712
+ : new RegExp(author, 'i');
13713
+ const matchesAuthor = ({ commit }) => {
13714
+ if (authorRegex === undefined) return true
13715
+ if (!commit.author) return false
13716
+ return authorRegex.test(`${commit.author.name} <${commit.author.email}>`)
13717
+ };
13718
+ const commits = [];
13705
13719
  // TODO: In the future, we may want to have an API where we return a
13706
13720
  // async iterator that emits commits.
13707
- const commits = [];
13721
+ // Commits that do not match the author pattern are omitted from the
13722
+ // result, but their history is still traversed so that file tracking and
13723
+ // `depth` behave as they do without a filter.
13724
+ const pushCommit = commit => {
13725
+ if (matchesAuthor(commit)) commits.push(commit);
13726
+ };
13708
13727
  const shallowCommits = await GitShallowManager.read({ fs, gitdir });
13709
13728
  const oid = await GitRefManager.resolve({ fs, gitdir, ref });
13710
13729
  const tips = [await _readCommit({ fs, cache, gitdir, oid })];
@@ -13714,7 +13733,7 @@ async function _log({
13714
13733
  let isOk;
13715
13734
 
13716
13735
  function endCommit(commit) {
13717
- if (isOk && filepath) commits.push(commit);
13736
+ if (isOk && filepath) pushCommit(commit);
13718
13737
  }
13719
13738
 
13720
13739
  while (tips.length > 0) {
@@ -13742,7 +13761,7 @@ async function _log({
13742
13761
  lastCommit &&
13743
13762
  (lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
13744
13763
  ) {
13745
- commits.push(lastCommit);
13764
+ pushCommit(lastCommit);
13746
13765
  }
13747
13766
  lastFileOid = vFileEntry.oid;
13748
13767
  lastFileMode = vFileEntry.mode;
@@ -13774,23 +13793,23 @@ async function _log({
13774
13793
  if (found.length === 1) {
13775
13794
  found = found[0];
13776
13795
  filepath = found;
13777
- if (lastCommit) commits.push(lastCommit);
13796
+ if (lastCommit) pushCommit(lastCommit);
13778
13797
  } else {
13779
13798
  found = false;
13780
- if (lastCommit) commits.push(lastCommit);
13799
+ if (lastCommit) pushCommit(lastCommit);
13781
13800
  break
13782
13801
  }
13783
13802
  }
13784
13803
  }
13785
13804
  } else {
13786
13805
  filepath = found;
13787
- if (lastCommit) commits.push(lastCommit);
13806
+ if (lastCommit) pushCommit(lastCommit);
13788
13807
  }
13789
13808
  }
13790
13809
  }
13791
13810
  if (!found) {
13792
13811
  if (isOk && lastFileOid) {
13793
- commits.push(lastCommit);
13812
+ pushCommit(lastCommit);
13794
13813
  if (!force) break
13795
13814
  }
13796
13815
  if (!force && !follow) throw e
@@ -13800,7 +13819,7 @@ async function _log({
13800
13819
  } else throw e
13801
13820
  }
13802
13821
  } else {
13803
- commits.push(commit);
13822
+ pushCommit(commit);
13804
13823
  }
13805
13824
 
13806
13825
  // Stop the loop if we have enough commits now.
@@ -13891,8 +13910,9 @@ async function getChanges({ fs, cache, gitdir, commit, shallow }) {
13891
13910
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
13892
13911
  * @param {string=} args.filepath optional get the commit for the filepath only
13893
13912
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
13894
- * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.
13913
+ * @param {number=} [args.depth] - Limit the number of commits returned (after `author` and `since` filters are applied). No limit by default.
13895
13914
  * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
13915
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string. (Unlike `git log --author`, which is case-sensitive and uses basic regular expressions.)
13896
13916
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13897
13917
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13898
13918
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
@@ -13920,6 +13940,7 @@ async function log({
13920
13940
  ref = 'HEAD',
13921
13941
  depth,
13922
13942
  since, // Date
13943
+ author,
13923
13944
  force,
13924
13945
  follow,
13925
13946
  includeChanges = false,
@@ -13940,6 +13961,7 @@ async function log({
13940
13961
  ref,
13941
13962
  depth,
13942
13963
  since,
13964
+ author,
13943
13965
  force,
13944
13966
  follow,
13945
13967
  includeChanges,
@@ -16947,7 +16969,16 @@ async function status({
16947
16969
 
16948
16970
  const H = treeOid !== null; // head
16949
16971
  const I = indexEntry !== null; // index
16950
- 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 })));
16951
16982
 
16952
16983
  const getWorkdirOid = async () => {
16953
16984
  if (I && !compareStats(indexEntry, stats)) {
@@ -17032,6 +17063,33 @@ async function status({
17032
17063
  }
17033
17064
  }
17034
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
+
17035
17093
  async function getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path }) {
17036
17094
  if (typeof path === 'string') path = path.split('/');
17037
17095
  const dirname = path.shift();
package/index.d.cts CHANGED
@@ -2179,8 +2179,9 @@ export function listTags({ fs, dir, gitdir }: {
2179
2179
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2180
2180
  * @param {string=} args.filepath optional get the commit for the filepath only
2181
2181
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
2182
- * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.
2182
+ * @param {number=} [args.depth] - Limit the number of commits returned (after `author` and `since` filters are applied). No limit by default.
2183
2183
  * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
2184
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string. (Unlike `git log --author`, which is case-sensitive and uses basic regular expressions.)
2184
2185
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
2185
2186
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
2186
2187
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
@@ -2200,7 +2201,7 @@ export function listTags({ fs, dir, gitdir }: {
2200
2201
  * console.log(commits)
2201
2202
  *
2202
2203
  */
2203
- export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follow, includeChanges, cache, }: {
2204
+ export function log({ fs, dir, gitdir, filepath, ref, depth, since, author, force, follow, includeChanges, cache, }: {
2204
2205
  fs: FsClient;
2205
2206
  dir?: string | undefined;
2206
2207
  gitdir?: string | undefined;
@@ -2208,6 +2209,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2208
2209
  ref?: string | undefined;
2209
2210
  depth?: number | undefined;
2210
2211
  since?: Date | undefined;
2212
+ author?: string | undefined;
2211
2213
  force?: boolean | undefined;
2212
2214
  follow?: boolean | undefined;
2213
2215
  includeChanges?: boolean | undefined;
package/index.d.ts CHANGED
@@ -2178,8 +2178,9 @@ export function listTags({ fs, dir, gitdir }: {
2178
2178
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2179
2179
  * @param {string=} args.filepath optional get the commit for the filepath only
2180
2180
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
2181
- * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.
2181
+ * @param {number=} [args.depth] - Limit the number of commits returned (after `author` and `since` filters are applied). No limit by default.
2182
2182
  * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
2183
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string. (Unlike `git log --author`, which is case-sensitive and uses basic regular expressions.)
2183
2184
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
2184
2185
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
2185
2186
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
@@ -2199,7 +2200,7 @@ export function listTags({ fs, dir, gitdir }: {
2199
2200
  * console.log(commits)
2200
2201
  *
2201
2202
  */
2202
- export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follow, includeChanges, cache, }: {
2203
+ export function log({ fs, dir, gitdir, filepath, ref, depth, since, author, force, follow, includeChanges, cache, }: {
2203
2204
  fs: FsClient;
2204
2205
  dir?: string | undefined;
2205
2206
  gitdir?: string | undefined;
@@ -2207,6 +2208,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2207
2208
  ref?: string | undefined;
2208
2209
  depth?: number | undefined;
2209
2210
  since?: Date | undefined;
2211
+ author?: string | undefined;
2210
2212
  force?: boolean | undefined;
2211
2213
  follow?: boolean | undefined;
2212
2214
  includeChanges?: boolean | undefined;
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.43.3',
10047
- agent: 'git/isomorphic-git@1.43.3',
10046
+ version: '1.44.1',
10047
+ agent: 'git/isomorphic-git@1.44.1',
10048
10048
  };
10049
10049
 
10050
10050
  class FIFO {
@@ -13660,6 +13660,7 @@ async function _resolveFileId({
13660
13660
  * @param {string=} args.filepath optional get the commit for the filepath only
13661
13661
  * @param {string} args.ref
13662
13662
  * @param {number|void} args.depth
13663
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string
13663
13664
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13664
13665
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13665
13666
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit.
@@ -13681,6 +13682,7 @@ async function _log({
13681
13682
  ref,
13682
13683
  depth,
13683
13684
  since,
13685
+ author,
13684
13686
  force,
13685
13687
  follow,
13686
13688
  includeChanges,
@@ -13689,9 +13691,26 @@ async function _log({
13689
13691
  typeof since === 'undefined'
13690
13692
  ? undefined
13691
13693
  : Math.floor(since.valueOf() / 1000);
13694
+ // The pattern is a case-insensitive JavaScript regular expression that is
13695
+ // matched against the author's "Name <email>" string.
13696
+ const authorRegex =
13697
+ author === undefined || author === null
13698
+ ? undefined
13699
+ : new RegExp(author, 'i');
13700
+ const matchesAuthor = ({ commit }) => {
13701
+ if (authorRegex === undefined) return true
13702
+ if (!commit.author) return false
13703
+ return authorRegex.test(`${commit.author.name} <${commit.author.email}>`)
13704
+ };
13705
+ const commits = [];
13692
13706
  // TODO: In the future, we may want to have an API where we return a
13693
13707
  // async iterator that emits commits.
13694
- const commits = [];
13708
+ // Commits that do not match the author pattern are omitted from the
13709
+ // result, but their history is still traversed so that file tracking and
13710
+ // `depth` behave as they do without a filter.
13711
+ const pushCommit = commit => {
13712
+ if (matchesAuthor(commit)) commits.push(commit);
13713
+ };
13695
13714
  const shallowCommits = await GitShallowManager.read({ fs, gitdir });
13696
13715
  const oid = await GitRefManager.resolve({ fs, gitdir, ref });
13697
13716
  const tips = [await _readCommit({ fs, cache, gitdir, oid })];
@@ -13701,7 +13720,7 @@ async function _log({
13701
13720
  let isOk;
13702
13721
 
13703
13722
  function endCommit(commit) {
13704
- if (isOk && filepath) commits.push(commit);
13723
+ if (isOk && filepath) pushCommit(commit);
13705
13724
  }
13706
13725
 
13707
13726
  while (tips.length > 0) {
@@ -13729,7 +13748,7 @@ async function _log({
13729
13748
  lastCommit &&
13730
13749
  (lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
13731
13750
  ) {
13732
- commits.push(lastCommit);
13751
+ pushCommit(lastCommit);
13733
13752
  }
13734
13753
  lastFileOid = vFileEntry.oid;
13735
13754
  lastFileMode = vFileEntry.mode;
@@ -13761,23 +13780,23 @@ async function _log({
13761
13780
  if (found.length === 1) {
13762
13781
  found = found[0];
13763
13782
  filepath = found;
13764
- if (lastCommit) commits.push(lastCommit);
13783
+ if (lastCommit) pushCommit(lastCommit);
13765
13784
  } else {
13766
13785
  found = false;
13767
- if (lastCommit) commits.push(lastCommit);
13786
+ if (lastCommit) pushCommit(lastCommit);
13768
13787
  break
13769
13788
  }
13770
13789
  }
13771
13790
  }
13772
13791
  } else {
13773
13792
  filepath = found;
13774
- if (lastCommit) commits.push(lastCommit);
13793
+ if (lastCommit) pushCommit(lastCommit);
13775
13794
  }
13776
13795
  }
13777
13796
  }
13778
13797
  if (!found) {
13779
13798
  if (isOk && lastFileOid) {
13780
- commits.push(lastCommit);
13799
+ pushCommit(lastCommit);
13781
13800
  if (!force) break
13782
13801
  }
13783
13802
  if (!force && !follow) throw e
@@ -13787,7 +13806,7 @@ async function _log({
13787
13806
  } else throw e
13788
13807
  }
13789
13808
  } else {
13790
- commits.push(commit);
13809
+ pushCommit(commit);
13791
13810
  }
13792
13811
 
13793
13812
  // Stop the loop if we have enough commits now.
@@ -13878,8 +13897,9 @@ async function getChanges({ fs, cache, gitdir, commit, shallow }) {
13878
13897
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
13879
13898
  * @param {string=} args.filepath optional get the commit for the filepath only
13880
13899
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
13881
- * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.
13900
+ * @param {number=} [args.depth] - Limit the number of commits returned (after `author` and `since` filters are applied). No limit by default.
13882
13901
  * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
13902
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string. (Unlike `git log --author`, which is case-sensitive and uses basic regular expressions.)
13883
13903
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13884
13904
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13885
13905
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
@@ -13907,6 +13927,7 @@ async function log({
13907
13927
  ref = 'HEAD',
13908
13928
  depth,
13909
13929
  since, // Date
13930
+ author,
13910
13931
  force,
13911
13932
  follow,
13912
13933
  includeChanges = false,
@@ -13927,6 +13948,7 @@ async function log({
13927
13948
  ref,
13928
13949
  depth,
13929
13950
  since,
13951
+ author,
13930
13952
  force,
13931
13953
  follow,
13932
13954
  includeChanges,
@@ -16934,7 +16956,16 @@ async function status({
16934
16956
 
16935
16957
  const H = treeOid !== null; // head
16936
16958
  const I = indexEntry !== null; // index
16937
- 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 })));
16938
16969
 
16939
16970
  const getWorkdirOid = async () => {
16940
16971
  if (I && !compareStats(indexEntry, stats)) {
@@ -17019,6 +17050,33 @@ async function status({
17019
17050
  }
17020
17051
  }
17021
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
+
17022
17080
  async function getOidAtPath({ fs, cache, gitdir: updatedGitdir, tree, path }) {
17023
17081
  if (typeof path === 'string') path = path.split('/');
17024
17082
  const dirname = path.shift();
@@ -2178,8 +2178,9 @@ export function listTags({ fs, dir, gitdir }: {
2178
2178
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2179
2179
  * @param {string=} args.filepath optional get the commit for the filepath only
2180
2180
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
2181
- * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.
2181
+ * @param {number=} [args.depth] - Limit the number of commits returned (after `author` and `since` filters are applied). No limit by default.
2182
2182
  * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
2183
+ * @param {string} [args.author] - Return only commits whose author matches this case-insensitive JavaScript regular expression, tested against the author's `Name <email>` string. (Unlike `git log --author`, which is case-sensitive and uses basic regular expressions.)
2183
2184
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
2184
2185
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
2185
2186
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
@@ -2199,7 +2200,7 @@ export function listTags({ fs, dir, gitdir }: {
2199
2200
  * console.log(commits)
2200
2201
  *
2201
2202
  */
2202
- export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follow, includeChanges, cache, }: {
2203
+ export function log({ fs, dir, gitdir, filepath, ref, depth, since, author, force, follow, includeChanges, cache, }: {
2203
2204
  fs: FsClient;
2204
2205
  dir?: string | undefined;
2205
2206
  gitdir?: string | undefined;
@@ -2207,6 +2208,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2207
2208
  ref?: string | undefined;
2208
2209
  depth?: number | undefined;
2209
2210
  since?: Date | undefined;
2211
+ author?: string | undefined;
2210
2212
  force?: boolean | undefined;
2211
2213
  follow?: boolean | undefined;
2212
2214
  includeChanges?: boolean | undefined;