isomorphic-git 1.43.2 → 1.44.0

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
@@ -461,6 +461,8 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
461
461
  </tr>
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
+ <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>
464
466
  </tr>
465
467
  </table>
466
468
 
package/index.cjs CHANGED
@@ -3718,37 +3718,12 @@ async function readObjectPacked({
3718
3718
  }
3719
3719
 
3720
3720
  // === Packfile Integrity Verification ===
3721
- // Performance optimization: use _checksumVerified flag to verify only once per packfile
3722
- if (!p._checksumVerified) {
3723
- const expectedShaFromIndex = p.packfileSha;
3724
-
3725
- // 1. Fast Check: Verify packfile trailer matches index record
3726
- // Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
3727
- const packTrailer = pack.subarray(-20);
3728
- const packTrailerSha = Array.from(packTrailer)
3729
- .map(b => b.toString(16).padStart(2, '0'))
3730
- .join('');
3731
- if (packTrailerSha !== expectedShaFromIndex) {
3732
- throw new InternalError(
3733
- `Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
3734
- )
3735
- }
3736
-
3737
- // 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
3738
- // The Node package build swaps in a chunked implementation for large packs.
3739
- const actualPayloadSha = await shasumRange(pack, {
3740
- start: 0,
3741
- end: pack.length - 20,
3742
- });
3743
- if (actualPayloadSha !== expectedShaFromIndex) {
3744
- throw new InternalError(
3745
- `Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
3746
- )
3747
- }
3748
-
3749
- // Mark as verified to prevent performance regression on subsequent reads
3750
- p._checksumVerified = true;
3721
+ // Performance optimization: verify only once per packfile.
3722
+ // Concurrent reads share the same verification promise.
3723
+ if (!p._checksumVerification) {
3724
+ p._checksumVerification = verifyPackfile(pack, p.packfileSha);
3751
3725
  }
3726
+ await p._checksumVerification;
3752
3727
 
3753
3728
  const result = await p.read({ oid, getExternalRefDelta });
3754
3729
  result.format = 'content';
@@ -3760,6 +3735,32 @@ async function readObjectPacked({
3760
3735
  return null
3761
3736
  }
3762
3737
 
3738
+ async function verifyPackfile(pack, expectedShaFromIndex) {
3739
+ // 1. Fast Check: Verify packfile trailer matches index record
3740
+ // Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
3741
+ const packTrailer = pack.subarray(-20);
3742
+ const packTrailerSha = Array.from(packTrailer)
3743
+ .map(b => b.toString(16).padStart(2, '0'))
3744
+ .join('');
3745
+ if (packTrailerSha !== expectedShaFromIndex) {
3746
+ throw new InternalError(
3747
+ `Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
3748
+ )
3749
+ }
3750
+
3751
+ // 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
3752
+ // The Node package build swaps in a chunked implementation for large packs.
3753
+ const actualPayloadSha = await shasumRange(pack, {
3754
+ start: 0,
3755
+ end: pack.length - 20,
3756
+ });
3757
+ if (actualPayloadSha !== expectedShaFromIndex) {
3758
+ throw new InternalError(
3759
+ `Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
3760
+ )
3761
+ }
3762
+ }
3763
+
3763
3764
  /**
3764
3765
  * @param {object} args
3765
3766
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
@@ -10055,8 +10056,8 @@ function filterCapabilities(server, client) {
10055
10056
 
10056
10057
  const pkg = {
10057
10058
  name: 'isomorphic-git',
10058
- version: '1.43.2',
10059
- agent: 'git/isomorphic-git@1.43.2',
10059
+ version: '1.44.0',
10060
+ agent: 'git/isomorphic-git@1.44.0',
10060
10061
  };
10061
10062
 
10062
10063
  class FIFO {
@@ -13672,6 +13673,7 @@ async function _resolveFileId({
13672
13673
  * @param {string=} args.filepath optional get the commit for the filepath only
13673
13674
  * @param {string} args.ref
13674
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
13675
13677
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13676
13678
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13677
13679
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit.
@@ -13693,6 +13695,7 @@ async function _log({
13693
13695
  ref,
13694
13696
  depth,
13695
13697
  since,
13698
+ author,
13696
13699
  force,
13697
13700
  follow,
13698
13701
  includeChanges,
@@ -13701,9 +13704,26 @@ async function _log({
13701
13704
  typeof since === 'undefined'
13702
13705
  ? undefined
13703
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 = [];
13704
13719
  // TODO: In the future, we may want to have an API where we return a
13705
13720
  // async iterator that emits commits.
13706
- 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
+ };
13707
13727
  const shallowCommits = await GitShallowManager.read({ fs, gitdir });
13708
13728
  const oid = await GitRefManager.resolve({ fs, gitdir, ref });
13709
13729
  const tips = [await _readCommit({ fs, cache, gitdir, oid })];
@@ -13713,7 +13733,7 @@ async function _log({
13713
13733
  let isOk;
13714
13734
 
13715
13735
  function endCommit(commit) {
13716
- if (isOk && filepath) commits.push(commit);
13736
+ if (isOk && filepath) pushCommit(commit);
13717
13737
  }
13718
13738
 
13719
13739
  while (tips.length > 0) {
@@ -13741,7 +13761,7 @@ async function _log({
13741
13761
  lastCommit &&
13742
13762
  (lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
13743
13763
  ) {
13744
- commits.push(lastCommit);
13764
+ pushCommit(lastCommit);
13745
13765
  }
13746
13766
  lastFileOid = vFileEntry.oid;
13747
13767
  lastFileMode = vFileEntry.mode;
@@ -13773,23 +13793,23 @@ async function _log({
13773
13793
  if (found.length === 1) {
13774
13794
  found = found[0];
13775
13795
  filepath = found;
13776
- if (lastCommit) commits.push(lastCommit);
13796
+ if (lastCommit) pushCommit(lastCommit);
13777
13797
  } else {
13778
13798
  found = false;
13779
- if (lastCommit) commits.push(lastCommit);
13799
+ if (lastCommit) pushCommit(lastCommit);
13780
13800
  break
13781
13801
  }
13782
13802
  }
13783
13803
  }
13784
13804
  } else {
13785
13805
  filepath = found;
13786
- if (lastCommit) commits.push(lastCommit);
13806
+ if (lastCommit) pushCommit(lastCommit);
13787
13807
  }
13788
13808
  }
13789
13809
  }
13790
13810
  if (!found) {
13791
13811
  if (isOk && lastFileOid) {
13792
- commits.push(lastCommit);
13812
+ pushCommit(lastCommit);
13793
13813
  if (!force) break
13794
13814
  }
13795
13815
  if (!force && !follow) throw e
@@ -13799,7 +13819,7 @@ async function _log({
13799
13819
  } else throw e
13800
13820
  }
13801
13821
  } else {
13802
- commits.push(commit);
13822
+ pushCommit(commit);
13803
13823
  }
13804
13824
 
13805
13825
  // Stop the loop if we have enough commits now.
@@ -13890,8 +13910,9 @@ async function getChanges({ fs, cache, gitdir, commit, shallow }) {
13890
13910
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
13891
13911
  * @param {string=} args.filepath optional get the commit for the filepath only
13892
13912
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
13893
- * @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.
13894
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.)
13895
13916
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13896
13917
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13897
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.
@@ -13919,6 +13940,7 @@ async function log({
13919
13940
  ref = 'HEAD',
13920
13941
  depth,
13921
13942
  since, // Date
13943
+ author,
13922
13944
  force,
13923
13945
  follow,
13924
13946
  includeChanges = false,
@@ -13939,6 +13961,7 @@ async function log({
13939
13961
  ref,
13940
13962
  depth,
13941
13963
  since,
13964
+ author,
13942
13965
  force,
13943
13966
  follow,
13944
13967
  includeChanges,
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
@@ -3705,37 +3705,12 @@ async function readObjectPacked({
3705
3705
  }
3706
3706
 
3707
3707
  // === Packfile Integrity Verification ===
3708
- // Performance optimization: use _checksumVerified flag to verify only once per packfile
3709
- if (!p._checksumVerified) {
3710
- const expectedShaFromIndex = p.packfileSha;
3711
-
3712
- // 1. Fast Check: Verify packfile trailer matches index record
3713
- // Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
3714
- const packTrailer = pack.subarray(-20);
3715
- const packTrailerSha = Array.from(packTrailer)
3716
- .map(b => b.toString(16).padStart(2, '0'))
3717
- .join('');
3718
- if (packTrailerSha !== expectedShaFromIndex) {
3719
- throw new InternalError(
3720
- `Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
3721
- )
3722
- }
3723
-
3724
- // 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
3725
- // The Node package build swaps in a chunked implementation for large packs.
3726
- const actualPayloadSha = await shasumRange(pack, {
3727
- start: 0,
3728
- end: pack.length - 20,
3729
- });
3730
- if (actualPayloadSha !== expectedShaFromIndex) {
3731
- throw new InternalError(
3732
- `Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
3733
- )
3734
- }
3735
-
3736
- // Mark as verified to prevent performance regression on subsequent reads
3737
- p._checksumVerified = true;
3708
+ // Performance optimization: verify only once per packfile.
3709
+ // Concurrent reads share the same verification promise.
3710
+ if (!p._checksumVerification) {
3711
+ p._checksumVerification = verifyPackfile(pack, p.packfileSha);
3738
3712
  }
3713
+ await p._checksumVerification;
3739
3714
 
3740
3715
  const result = await p.read({ oid, getExternalRefDelta });
3741
3716
  result.format = 'content';
@@ -3747,6 +3722,32 @@ async function readObjectPacked({
3747
3722
  return null
3748
3723
  }
3749
3724
 
3725
+ async function verifyPackfile(pack, expectedShaFromIndex) {
3726
+ // 1. Fast Check: Verify packfile trailer matches index record
3727
+ // Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
3728
+ const packTrailer = pack.subarray(-20);
3729
+ const packTrailerSha = Array.from(packTrailer)
3730
+ .map(b => b.toString(16).padStart(2, '0'))
3731
+ .join('');
3732
+ if (packTrailerSha !== expectedShaFromIndex) {
3733
+ throw new InternalError(
3734
+ `Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
3735
+ )
3736
+ }
3737
+
3738
+ // 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
3739
+ // The Node package build swaps in a chunked implementation for large packs.
3740
+ const actualPayloadSha = await shasumRange(pack, {
3741
+ start: 0,
3742
+ end: pack.length - 20,
3743
+ });
3744
+ if (actualPayloadSha !== expectedShaFromIndex) {
3745
+ throw new InternalError(
3746
+ `Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
3747
+ )
3748
+ }
3749
+ }
3750
+
3750
3751
  /**
3751
3752
  * @param {object} args
3752
3753
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
@@ -10042,8 +10043,8 @@ function filterCapabilities(server, client) {
10042
10043
 
10043
10044
  const pkg = {
10044
10045
  name: 'isomorphic-git',
10045
- version: '1.43.2',
10046
- agent: 'git/isomorphic-git@1.43.2',
10046
+ version: '1.44.0',
10047
+ agent: 'git/isomorphic-git@1.44.0',
10047
10048
  };
10048
10049
 
10049
10050
  class FIFO {
@@ -13659,6 +13660,7 @@ async function _resolveFileId({
13659
13660
  * @param {string=} args.filepath optional get the commit for the filepath only
13660
13661
  * @param {string} args.ref
13661
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
13662
13664
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13663
13665
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13664
13666
  * @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit.
@@ -13680,6 +13682,7 @@ async function _log({
13680
13682
  ref,
13681
13683
  depth,
13682
13684
  since,
13685
+ author,
13683
13686
  force,
13684
13687
  follow,
13685
13688
  includeChanges,
@@ -13688,9 +13691,26 @@ async function _log({
13688
13691
  typeof since === 'undefined'
13689
13692
  ? undefined
13690
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 = [];
13691
13706
  // TODO: In the future, we may want to have an API where we return a
13692
13707
  // async iterator that emits commits.
13693
- 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
+ };
13694
13714
  const shallowCommits = await GitShallowManager.read({ fs, gitdir });
13695
13715
  const oid = await GitRefManager.resolve({ fs, gitdir, ref });
13696
13716
  const tips = [await _readCommit({ fs, cache, gitdir, oid })];
@@ -13700,7 +13720,7 @@ async function _log({
13700
13720
  let isOk;
13701
13721
 
13702
13722
  function endCommit(commit) {
13703
- if (isOk && filepath) commits.push(commit);
13723
+ if (isOk && filepath) pushCommit(commit);
13704
13724
  }
13705
13725
 
13706
13726
  while (tips.length > 0) {
@@ -13728,7 +13748,7 @@ async function _log({
13728
13748
  lastCommit &&
13729
13749
  (lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
13730
13750
  ) {
13731
- commits.push(lastCommit);
13751
+ pushCommit(lastCommit);
13732
13752
  }
13733
13753
  lastFileOid = vFileEntry.oid;
13734
13754
  lastFileMode = vFileEntry.mode;
@@ -13760,23 +13780,23 @@ async function _log({
13760
13780
  if (found.length === 1) {
13761
13781
  found = found[0];
13762
13782
  filepath = found;
13763
- if (lastCommit) commits.push(lastCommit);
13783
+ if (lastCommit) pushCommit(lastCommit);
13764
13784
  } else {
13765
13785
  found = false;
13766
- if (lastCommit) commits.push(lastCommit);
13786
+ if (lastCommit) pushCommit(lastCommit);
13767
13787
  break
13768
13788
  }
13769
13789
  }
13770
13790
  }
13771
13791
  } else {
13772
13792
  filepath = found;
13773
- if (lastCommit) commits.push(lastCommit);
13793
+ if (lastCommit) pushCommit(lastCommit);
13774
13794
  }
13775
13795
  }
13776
13796
  }
13777
13797
  if (!found) {
13778
13798
  if (isOk && lastFileOid) {
13779
- commits.push(lastCommit);
13799
+ pushCommit(lastCommit);
13780
13800
  if (!force) break
13781
13801
  }
13782
13802
  if (!force && !follow) throw e
@@ -13786,7 +13806,7 @@ async function _log({
13786
13806
  } else throw e
13787
13807
  }
13788
13808
  } else {
13789
- commits.push(commit);
13809
+ pushCommit(commit);
13790
13810
  }
13791
13811
 
13792
13812
  // Stop the loop if we have enough commits now.
@@ -13877,8 +13897,9 @@ async function getChanges({ fs, cache, gitdir, commit, shallow }) {
13877
13897
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
13878
13898
  * @param {string=} args.filepath optional get the commit for the filepath only
13879
13899
  * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
13880
- * @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.
13881
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.)
13882
13903
  * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
13883
13904
  * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
13884
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.
@@ -13906,6 +13927,7 @@ async function log({
13906
13927
  ref = 'HEAD',
13907
13928
  depth,
13908
13929
  since, // Date
13930
+ author,
13909
13931
  force,
13910
13932
  follow,
13911
13933
  includeChanges = false,
@@ -13926,6 +13948,7 @@ async function log({
13926
13948
  ref,
13927
13949
  depth,
13928
13950
  since,
13951
+ author,
13929
13952
  force,
13930
13953
  follow,
13931
13954
  includeChanges,
@@ -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;