isomorphic-git 1.40.5 → 1.40.7

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
@@ -8320,7 +8320,7 @@ async function checkAndWriteBlob(fs, gitdir, dir, filepath, oid = null) {
8320
8320
  : undefined;
8321
8321
  let retOid = objContent ? oid : undefined;
8322
8322
  if (!objContent) {
8323
- await acquireLock$1({ fs, gitdir, currentFilepath }, async () => {
8323
+ await acquireLock$1(currentFilepath, async () => {
8324
8324
  const object = stats.isSymbolicLink()
8325
8325
  ? await fs.readlink(currentFilepath).then(posixifyPathBuffer)
8326
8326
  : await fs.read(currentFilepath);
@@ -8535,7 +8535,7 @@ async function applyTreeChanges({
8535
8535
  });
8536
8536
 
8537
8537
  // apply the changes to work dir
8538
- await acquireLock$1({ fs, gitdir, dirRemoved, ops }, async () => {
8538
+ await acquireLock$1(gitdir, async () => {
8539
8539
  for (const op of ops) {
8540
8540
  const currentFilepath = join(dir, op.filepath);
8541
8541
  switch (op.method) {
@@ -8883,8 +8883,10 @@ async function _currentBranch({
8883
8883
  }
8884
8884
 
8885
8885
  function translateSSHtoHTTP(url) {
8886
- // handle "shorter scp-like syntax"
8887
- url = url.replace(/^git@([^:]+):/, 'https://$1/');
8886
+ // handle "shorter scp-like syntax". The user is dropped: it names an ssh
8887
+ // account and means nothing over https, which is what the old expression did
8888
+ // for `git@` too.
8889
+ url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
8888
8890
  // handle proper SSH URLs
8889
8891
  url = url.replace(/^ssh:\/\//, 'https://');
8890
8892
  return url
@@ -9389,9 +9391,15 @@ class GitRemoteManager {
9389
9391
  * @param {string} args.url - The URL of the remote repository.
9390
9392
  * @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
9391
9393
  */
9394
+ // git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
9395
+ // user is part of the syntax, not part of the word `git`, and a self-hosted
9396
+ // forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
9397
+ // and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
9398
+ // `scheme:address` override are left to the expression below.
9399
+ const scpLike = /^[^/@:]+@[^/@:]+:/;
9400
+
9392
9401
  function parseRemoteUrl({ url }) {
9393
- // the stupid "shorter scp-like syntax"
9394
- if (url.startsWith('git@')) {
9402
+ if (scpLike.test(url)) {
9395
9403
  return {
9396
9404
  transport: 'ssh',
9397
9405
  address: url,
@@ -9572,8 +9580,8 @@ function filterCapabilities(server, client) {
9572
9580
 
9573
9581
  const pkg = {
9574
9582
  name: 'isomorphic-git',
9575
- version: '1.40.5',
9576
- agent: 'git/isomorphic-git@1.40.5',
9583
+ version: '1.40.7',
9584
+ agent: 'git/isomorphic-git@1.40.7',
9577
9585
  };
9578
9586
 
9579
9587
  class FIFO {
@@ -15930,7 +15938,7 @@ class GitStashManager {
15930
15938
  );
15931
15939
  const filepath = this.refLogsStashPath;
15932
15940
 
15933
- await acquireLock$1({ filepath, entry }, async () => {
15941
+ await acquireLock$1(filepath, async () => {
15934
15942
  const appendTo = (await this.fs.exists(filepath))
15935
15943
  ? await this.fs.read(filepath, 'utf8')
15936
15944
  : '';
@@ -16140,7 +16148,7 @@ async function _stashDrop({ fs, dir, gitdir, refIdx = 0 }) {
16140
16148
  reflogEntries.splice(refIdx, 1);
16141
16149
 
16142
16150
  const stashReflogPath = stashMgr.refLogsStashPath;
16143
- await acquireLock$1({ reflogEntries, stashReflogPath, stashMgr }, async () => {
16151
+ await acquireLock$1(stashReflogPath, async () => {
16144
16152
  if (reflogEntries.length) {
16145
16153
  await fs.write(
16146
16154
  stashReflogPath,
package/index.js CHANGED
@@ -8307,7 +8307,7 @@ async function checkAndWriteBlob(fs, gitdir, dir, filepath, oid = null) {
8307
8307
  : undefined;
8308
8308
  let retOid = objContent ? oid : undefined;
8309
8309
  if (!objContent) {
8310
- await acquireLock$1({ fs, gitdir, currentFilepath }, async () => {
8310
+ await acquireLock$1(currentFilepath, async () => {
8311
8311
  const object = stats.isSymbolicLink()
8312
8312
  ? await fs.readlink(currentFilepath).then(posixifyPathBuffer)
8313
8313
  : await fs.read(currentFilepath);
@@ -8522,7 +8522,7 @@ async function applyTreeChanges({
8522
8522
  });
8523
8523
 
8524
8524
  // apply the changes to work dir
8525
- await acquireLock$1({ fs, gitdir, dirRemoved, ops }, async () => {
8525
+ await acquireLock$1(gitdir, async () => {
8526
8526
  for (const op of ops) {
8527
8527
  const currentFilepath = join(dir, op.filepath);
8528
8528
  switch (op.method) {
@@ -8870,8 +8870,10 @@ async function _currentBranch({
8870
8870
  }
8871
8871
 
8872
8872
  function translateSSHtoHTTP(url) {
8873
- // handle "shorter scp-like syntax"
8874
- url = url.replace(/^git@([^:]+):/, 'https://$1/');
8873
+ // handle "shorter scp-like syntax". The user is dropped: it names an ssh
8874
+ // account and means nothing over https, which is what the old expression did
8875
+ // for `git@` too.
8876
+ url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
8875
8877
  // handle proper SSH URLs
8876
8878
  url = url.replace(/^ssh:\/\//, 'https://');
8877
8879
  return url
@@ -9376,9 +9378,15 @@ class GitRemoteManager {
9376
9378
  * @param {string} args.url - The URL of the remote repository.
9377
9379
  * @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
9378
9380
  */
9381
+ // git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
9382
+ // user is part of the syntax, not part of the word `git`, and a self-hosted
9383
+ // forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
9384
+ // and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
9385
+ // `scheme:address` override are left to the expression below.
9386
+ const scpLike = /^[^/@:]+@[^/@:]+:/;
9387
+
9379
9388
  function parseRemoteUrl({ url }) {
9380
- // the stupid "shorter scp-like syntax"
9381
- if (url.startsWith('git@')) {
9389
+ if (scpLike.test(url)) {
9382
9390
  return {
9383
9391
  transport: 'ssh',
9384
9392
  address: url,
@@ -9559,8 +9567,8 @@ function filterCapabilities(server, client) {
9559
9567
 
9560
9568
  const pkg = {
9561
9569
  name: 'isomorphic-git',
9562
- version: '1.40.5',
9563
- agent: 'git/isomorphic-git@1.40.5',
9570
+ version: '1.40.7',
9571
+ agent: 'git/isomorphic-git@1.40.7',
9564
9572
  };
9565
9573
 
9566
9574
  class FIFO {
@@ -15917,7 +15925,7 @@ class GitStashManager {
15917
15925
  );
15918
15926
  const filepath = this.refLogsStashPath;
15919
15927
 
15920
- await acquireLock$1({ filepath, entry }, async () => {
15928
+ await acquireLock$1(filepath, async () => {
15921
15929
  const appendTo = (await this.fs.exists(filepath))
15922
15930
  ? await this.fs.read(filepath, 'utf8')
15923
15931
  : '';
@@ -16127,7 +16135,7 @@ async function _stashDrop({ fs, dir, gitdir, refIdx = 0 }) {
16127
16135
  reflogEntries.splice(refIdx, 1);
16128
16136
 
16129
16137
  const stashReflogPath = stashMgr.refLogsStashPath;
16130
- await acquireLock$1({ reflogEntries, stashReflogPath, stashMgr }, async () => {
16138
+ await acquireLock$1(stashReflogPath, async () => {
16131
16139
  if (reflogEntries.length) {
16132
16140
  await fs.write(
16133
16141
  stashReflogPath,