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 +18 -10
- package/index.js +18 -10
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +15 -7
- package/managers/index.js +15 -7
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/managers/index.cjs
CHANGED
|
@@ -3097,8 +3097,10 @@ class UrlParseError extends BaseError {
|
|
|
3097
3097
|
UrlParseError.code = 'UrlParseError';
|
|
3098
3098
|
|
|
3099
3099
|
function translateSSHtoHTTP(url) {
|
|
3100
|
-
// handle "shorter scp-like syntax"
|
|
3101
|
-
|
|
3100
|
+
// handle "shorter scp-like syntax". The user is dropped: it names an ssh
|
|
3101
|
+
// account and means nothing over https, which is what the old expression did
|
|
3102
|
+
// for `git@` too.
|
|
3103
|
+
url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
|
|
3102
3104
|
// handle proper SSH URLs
|
|
3103
3105
|
url = url.replace(/^ssh:\/\//, 'https://');
|
|
3104
3106
|
return url
|
|
@@ -3145,9 +3147,15 @@ class GitRemoteManager {
|
|
|
3145
3147
|
* @param {string} args.url - The URL of the remote repository.
|
|
3146
3148
|
* @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
|
|
3147
3149
|
*/
|
|
3150
|
+
// git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
|
|
3151
|
+
// user is part of the syntax, not part of the word `git`, and a self-hosted
|
|
3152
|
+
// forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
|
|
3153
|
+
// and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
|
|
3154
|
+
// `scheme:address` override are left to the expression below.
|
|
3155
|
+
const scpLike = /^[^/@:]+@[^/@:]+:/;
|
|
3156
|
+
|
|
3148
3157
|
function parseRemoteUrl({ url }) {
|
|
3149
|
-
|
|
3150
|
-
if (url.startsWith('git@')) {
|
|
3158
|
+
if (scpLike.test(url)) {
|
|
3151
3159
|
return {
|
|
3152
3160
|
transport: 'ssh',
|
|
3153
3161
|
address: url,
|
|
@@ -5971,7 +5979,7 @@ async function checkAndWriteBlob(fs, gitdir, dir, filepath, oid = null) {
|
|
|
5971
5979
|
: undefined;
|
|
5972
5980
|
let retOid = objContent ? oid : undefined;
|
|
5973
5981
|
if (!objContent) {
|
|
5974
|
-
await acquireLock$1(
|
|
5982
|
+
await acquireLock$1(currentFilepath, async () => {
|
|
5975
5983
|
const object = stats.isSymbolicLink()
|
|
5976
5984
|
? await fs.readlink(currentFilepath).then(posixifyPathBuffer)
|
|
5977
5985
|
: await fs.read(currentFilepath);
|
|
@@ -6186,7 +6194,7 @@ async function applyTreeChanges({
|
|
|
6186
6194
|
});
|
|
6187
6195
|
|
|
6188
6196
|
// apply the changes to work dir
|
|
6189
|
-
await acquireLock$1(
|
|
6197
|
+
await acquireLock$1(gitdir, async () => {
|
|
6190
6198
|
for (const op of ops) {
|
|
6191
6199
|
const currentFilepath = join(dir, op.filepath);
|
|
6192
6200
|
switch (op.method) {
|
|
@@ -6417,7 +6425,7 @@ class GitStashManager {
|
|
|
6417
6425
|
);
|
|
6418
6426
|
const filepath = this.refLogsStashPath;
|
|
6419
6427
|
|
|
6420
|
-
await acquireLock$1(
|
|
6428
|
+
await acquireLock$1(filepath, async () => {
|
|
6421
6429
|
const appendTo = (await this.fs.exists(filepath))
|
|
6422
6430
|
? await this.fs.read(filepath, 'utf8')
|
|
6423
6431
|
: '';
|
package/managers/index.js
CHANGED
|
@@ -3090,8 +3090,10 @@ class UrlParseError extends BaseError {
|
|
|
3090
3090
|
UrlParseError.code = 'UrlParseError';
|
|
3091
3091
|
|
|
3092
3092
|
function translateSSHtoHTTP(url) {
|
|
3093
|
-
// handle "shorter scp-like syntax"
|
|
3094
|
-
|
|
3093
|
+
// handle "shorter scp-like syntax". The user is dropped: it names an ssh
|
|
3094
|
+
// account and means nothing over https, which is what the old expression did
|
|
3095
|
+
// for `git@` too.
|
|
3096
|
+
url = url.replace(/^[^/@:]+@([^/@:]+):/, 'https://$1/');
|
|
3095
3097
|
// handle proper SSH URLs
|
|
3096
3098
|
url = url.replace(/^ssh:\/\//, 'https://');
|
|
3097
3099
|
return url
|
|
@@ -3138,9 +3140,15 @@ class GitRemoteManager {
|
|
|
3138
3140
|
* @param {string} args.url - The URL of the remote repository.
|
|
3139
3141
|
* @returns {Object|undefined} - An object containing the transport and address, or undefined if parsing fails.
|
|
3140
3142
|
*/
|
|
3143
|
+
// git-clone(1) calls this the "shorter scp-like syntax": [user@]host:path. The
|
|
3144
|
+
// user is part of the syntax, not part of the word `git`, and a self-hosted
|
|
3145
|
+
// forge is as likely to hand out `gitolite@`, `forgejo@` or `ubuntu@`. The host
|
|
3146
|
+
// and the user cannot hold a slash, an at sign or a colon, so `https://x` and a
|
|
3147
|
+
// `scheme:address` override are left to the expression below.
|
|
3148
|
+
const scpLike = /^[^/@:]+@[^/@:]+:/;
|
|
3149
|
+
|
|
3141
3150
|
function parseRemoteUrl({ url }) {
|
|
3142
|
-
|
|
3143
|
-
if (url.startsWith('git@')) {
|
|
3151
|
+
if (scpLike.test(url)) {
|
|
3144
3152
|
return {
|
|
3145
3153
|
transport: 'ssh',
|
|
3146
3154
|
address: url,
|
|
@@ -5958,7 +5966,7 @@ async function checkAndWriteBlob(fs, gitdir, dir, filepath, oid = null) {
|
|
|
5958
5966
|
: undefined;
|
|
5959
5967
|
let retOid = objContent ? oid : undefined;
|
|
5960
5968
|
if (!objContent) {
|
|
5961
|
-
await acquireLock$1(
|
|
5969
|
+
await acquireLock$1(currentFilepath, async () => {
|
|
5962
5970
|
const object = stats.isSymbolicLink()
|
|
5963
5971
|
? await fs.readlink(currentFilepath).then(posixifyPathBuffer)
|
|
5964
5972
|
: await fs.read(currentFilepath);
|
|
@@ -6173,7 +6181,7 @@ async function applyTreeChanges({
|
|
|
6173
6181
|
});
|
|
6174
6182
|
|
|
6175
6183
|
// apply the changes to work dir
|
|
6176
|
-
await acquireLock$1(
|
|
6184
|
+
await acquireLock$1(gitdir, async () => {
|
|
6177
6185
|
for (const op of ops) {
|
|
6178
6186
|
const currentFilepath = join(dir, op.filepath);
|
|
6179
6187
|
switch (op.method) {
|
|
@@ -6404,7 +6412,7 @@ class GitStashManager {
|
|
|
6404
6412
|
);
|
|
6405
6413
|
const filepath = this.refLogsStashPath;
|
|
6406
6414
|
|
|
6407
|
-
await acquireLock$1(
|
|
6415
|
+
await acquireLock$1(filepath, async () => {
|
|
6408
6416
|
const appendTo = (await this.fs.exists(filepath))
|
|
6409
6417
|
? await this.fs.read(filepath, 'utf8')
|
|
6410
6418
|
: '';
|