isomorphic-git 1.44.15 → 1.44.17
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/LICENSE.md +52 -0
- package/http/node/index.cjs +102 -26
- package/http/node/index.d.cts +8 -0
- package/http/node/index.d.ts +8 -0
- package/http/node/index.js +102 -26
- package/index.cjs +70 -54
- package/index.js +70 -54
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.LICENSE.txt +20 -12
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +68 -52
- package/managers/index.js +68 -52
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.LICENSE.txt +20 -12
- package/managers/index.umd.min.js.map +1 -1
- package/models/index.cjs +69 -53
- package/models/index.js +69 -53
- package/models/index.umd.min.js +1 -1
- package/models/index.umd.min.js.LICENSE.txt +14 -6
- package/models/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/LICENSE.md
CHANGED
|
@@ -5,3 +5,55 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
5
5
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
6
|
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
+
|
|
9
|
+
## Third-party code
|
|
10
|
+
|
|
11
|
+
### path-browserify
|
|
12
|
+
|
|
13
|
+
`src/utils/join.js` contains the POSIX path normalisation from
|
|
14
|
+
[path-browserify](https://github.com/browserify/path-browserify), which
|
|
15
|
+
extracted it from Node.js.
|
|
16
|
+
|
|
17
|
+
MIT License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2013 James Halliday
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
22
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
23
|
+
the Software without restriction, including without limitation the rights to
|
|
24
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
25
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
26
|
+
subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
33
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
34
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
35
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
36
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
37
|
+
|
|
38
|
+
The Node.js code it was extracted from carries its own notice:
|
|
39
|
+
|
|
40
|
+
Copyright Joyent, Inc. and other Node contributors.
|
|
41
|
+
|
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
43
|
+
copy of this software and associated documentation files (the
|
|
44
|
+
"Software"), to deal in the Software without restriction, including
|
|
45
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
46
|
+
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
47
|
+
persons to whom the Software is furnished to do so, subject to the
|
|
48
|
+
following conditions:
|
|
49
|
+
|
|
50
|
+
The above copyright notice and this permission notice shall be included
|
|
51
|
+
in all copies or substantial portions of the Software.
|
|
52
|
+
|
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
54
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
55
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
56
|
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
57
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
58
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
59
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/http/node/index.cjs
CHANGED
|
@@ -207,37 +207,113 @@ async function request({
|
|
|
207
207
|
// @ts-expect-error
|
|
208
208
|
body = asyncIteratorToStream(body);
|
|
209
209
|
}
|
|
210
|
+
const { followRedirects = true, maxRedirects = 10, ...options } = fetchOptions;
|
|
211
|
+
/** @type {RedirectableRequest} */
|
|
212
|
+
let next = { url, method: method.toUpperCase(), headers, body };
|
|
213
|
+
for (let redirects = 0; ; redirects++) {
|
|
214
|
+
const res = await send({
|
|
215
|
+
...options,
|
|
216
|
+
...next,
|
|
217
|
+
agent,
|
|
218
|
+
signal: signal ?? options.signal,
|
|
219
|
+
});
|
|
220
|
+
const location = res.headers.location;
|
|
221
|
+
if (
|
|
222
|
+
!followRedirects ||
|
|
223
|
+
res.statusCode < 300 ||
|
|
224
|
+
res.statusCode >= 400 ||
|
|
225
|
+
!location
|
|
226
|
+
) {
|
|
227
|
+
return toResponse(res)
|
|
228
|
+
}
|
|
229
|
+
// Discard the redirect body. simple-get has already wrapped it in a
|
|
230
|
+
// decompressor, so a malformed body must not become an unhandled error.
|
|
231
|
+
res.on('error', () => {});
|
|
232
|
+
res.resume();
|
|
233
|
+
if (redirects >= maxRedirects) throw new Error('too many redirects')
|
|
234
|
+
next = redirectRequest(next, res.statusCode, location);
|
|
235
|
+
// simple-get builds a body from `form` on every call; like its own
|
|
236
|
+
// redirect handling, send it only with the first request.
|
|
237
|
+
delete options.form;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @typedef {Object} RedirectableRequest
|
|
243
|
+
* @property {string} url
|
|
244
|
+
* @property {string} method
|
|
245
|
+
* @property {Object<string, string>} headers
|
|
246
|
+
* @property {any} body
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Follows a redirect the way simple-get did, except that credentials are scoped
|
|
251
|
+
* to an origin (scheme, host and port) rather than to a hostname, like curl,
|
|
252
|
+
* which canonical git uses. simple-get kept the Authorization header when a
|
|
253
|
+
* redirect changed only the port or the scheme.
|
|
254
|
+
*
|
|
255
|
+
* @param {RedirectableRequest} previous
|
|
256
|
+
* @param {number} statusCode
|
|
257
|
+
* @param {string} location
|
|
258
|
+
* @returns {RedirectableRequest}
|
|
259
|
+
*/
|
|
260
|
+
function redirectRequest(previous, statusCode, location) {
|
|
261
|
+
const url = new URL(location, previous.url);
|
|
262
|
+
const sameOrigin = url.origin === new URL(previous.url).origin;
|
|
263
|
+
let { method, body } = previous;
|
|
264
|
+
const dropped = ['host'];
|
|
265
|
+
if (!sameOrigin) dropped.push('authorization', 'cookie');
|
|
266
|
+
// Like curl and RFC 7231 §6.4.4, a 303 always turns into a GET; a 301 or 302
|
|
267
|
+
// turns only a POST into one.
|
|
268
|
+
if (
|
|
269
|
+
(statusCode === 303 && method !== 'GET' && method !== 'HEAD') ||
|
|
270
|
+
(method === 'POST' && (statusCode === 301 || statusCode === 302))
|
|
271
|
+
) {
|
|
272
|
+
method = 'GET';
|
|
273
|
+
body = undefined;
|
|
274
|
+
dropped.push('content-length', 'content-type');
|
|
275
|
+
} else if (body && !Buffer.isBuffer(body)) {
|
|
276
|
+
// A streamed body has been read by the first request and would be resent
|
|
277
|
+
// empty.
|
|
278
|
+
throw new Error(
|
|
279
|
+
`cannot follow a ${statusCode} redirect: the request body is a stream and cannot be replayed`
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
/** @type {Object<string, string>} */
|
|
283
|
+
const headers = {};
|
|
284
|
+
for (const [name, value] of Object.entries(previous.headers)) {
|
|
285
|
+
if (!dropped.includes(name.toLowerCase())) headers[name] = value;
|
|
286
|
+
}
|
|
287
|
+
return { url: url.href, method, headers, body }
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @param {object} options
|
|
292
|
+
* @returns {Promise<any>}
|
|
293
|
+
*/
|
|
294
|
+
function send(options) {
|
|
210
295
|
return new Promise((resolve, reject) => {
|
|
211
|
-
get(
|
|
212
|
-
|
|
213
|
-
...fetchOptions,
|
|
214
|
-
url,
|
|
215
|
-
method,
|
|
216
|
-
headers,
|
|
217
|
-
agent,
|
|
218
|
-
body,
|
|
219
|
-
signal: signal ?? fetchOptions.signal,
|
|
220
|
-
},
|
|
221
|
-
(err, res) => {
|
|
222
|
-
if (err) return reject(err)
|
|
223
|
-
try {
|
|
224
|
-
const iter = fromNodeStream(res);
|
|
225
|
-
resolve({
|
|
226
|
-
url: res.url,
|
|
227
|
-
method: res.method,
|
|
228
|
-
statusCode: res.statusCode,
|
|
229
|
-
statusMessage: res.statusMessage,
|
|
230
|
-
body: iter,
|
|
231
|
-
headers: res.headers,
|
|
232
|
-
});
|
|
233
|
-
} catch (e) {
|
|
234
|
-
reject(e);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
296
|
+
get({ ...options, followRedirects: false }, (err, res) =>
|
|
297
|
+
err ? reject(err) : resolve(res)
|
|
237
298
|
);
|
|
238
299
|
})
|
|
239
300
|
}
|
|
240
301
|
|
|
302
|
+
/**
|
|
303
|
+
* @param {any} res
|
|
304
|
+
* @returns {GitHttpResponse}
|
|
305
|
+
*/
|
|
306
|
+
function toResponse(res) {
|
|
307
|
+
return {
|
|
308
|
+
url: res.url,
|
|
309
|
+
method: res.method,
|
|
310
|
+
statusCode: res.statusCode,
|
|
311
|
+
statusMessage: res.statusMessage,
|
|
312
|
+
body: fromNodeStream(res),
|
|
313
|
+
headers: res.headers,
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
241
317
|
var index = { request };
|
|
242
318
|
|
|
243
319
|
exports.default = index;
|
package/http/node/index.d.cts
CHANGED
|
@@ -74,6 +74,14 @@ export type HttpFetch = (request: GitHttpRequest) => Promise<GitHttpResponse>;
|
|
|
74
74
|
export type HttpClient = {
|
|
75
75
|
request: HttpFetch;
|
|
76
76
|
};
|
|
77
|
+
export type RedirectableRequest = {
|
|
78
|
+
url: string;
|
|
79
|
+
method: string;
|
|
80
|
+
headers: {
|
|
81
|
+
[x: string]: string;
|
|
82
|
+
};
|
|
83
|
+
body: any;
|
|
84
|
+
};
|
|
77
85
|
declare namespace index {
|
|
78
86
|
export { request };
|
|
79
87
|
}
|
package/http/node/index.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ export type HttpFetch = (request: GitHttpRequest) => Promise<GitHttpResponse>;
|
|
|
73
73
|
export type HttpClient = {
|
|
74
74
|
request: HttpFetch;
|
|
75
75
|
};
|
|
76
|
+
export type RedirectableRequest = {
|
|
77
|
+
url: string;
|
|
78
|
+
method: string;
|
|
79
|
+
headers: {
|
|
80
|
+
[x: string]: string;
|
|
81
|
+
};
|
|
82
|
+
body: any;
|
|
83
|
+
};
|
|
76
84
|
declare namespace index {
|
|
77
85
|
export { request };
|
|
78
86
|
}
|
package/http/node/index.js
CHANGED
|
@@ -201,37 +201,113 @@ async function request({
|
|
|
201
201
|
// @ts-expect-error
|
|
202
202
|
body = asyncIteratorToStream(body);
|
|
203
203
|
}
|
|
204
|
+
const { followRedirects = true, maxRedirects = 10, ...options } = fetchOptions;
|
|
205
|
+
/** @type {RedirectableRequest} */
|
|
206
|
+
let next = { url, method: method.toUpperCase(), headers, body };
|
|
207
|
+
for (let redirects = 0; ; redirects++) {
|
|
208
|
+
const res = await send({
|
|
209
|
+
...options,
|
|
210
|
+
...next,
|
|
211
|
+
agent,
|
|
212
|
+
signal: signal ?? options.signal,
|
|
213
|
+
});
|
|
214
|
+
const location = res.headers.location;
|
|
215
|
+
if (
|
|
216
|
+
!followRedirects ||
|
|
217
|
+
res.statusCode < 300 ||
|
|
218
|
+
res.statusCode >= 400 ||
|
|
219
|
+
!location
|
|
220
|
+
) {
|
|
221
|
+
return toResponse(res)
|
|
222
|
+
}
|
|
223
|
+
// Discard the redirect body. simple-get has already wrapped it in a
|
|
224
|
+
// decompressor, so a malformed body must not become an unhandled error.
|
|
225
|
+
res.on('error', () => {});
|
|
226
|
+
res.resume();
|
|
227
|
+
if (redirects >= maxRedirects) throw new Error('too many redirects')
|
|
228
|
+
next = redirectRequest(next, res.statusCode, location);
|
|
229
|
+
// simple-get builds a body from `form` on every call; like its own
|
|
230
|
+
// redirect handling, send it only with the first request.
|
|
231
|
+
delete options.form;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @typedef {Object} RedirectableRequest
|
|
237
|
+
* @property {string} url
|
|
238
|
+
* @property {string} method
|
|
239
|
+
* @property {Object<string, string>} headers
|
|
240
|
+
* @property {any} body
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Follows a redirect the way simple-get did, except that credentials are scoped
|
|
245
|
+
* to an origin (scheme, host and port) rather than to a hostname, like curl,
|
|
246
|
+
* which canonical git uses. simple-get kept the Authorization header when a
|
|
247
|
+
* redirect changed only the port or the scheme.
|
|
248
|
+
*
|
|
249
|
+
* @param {RedirectableRequest} previous
|
|
250
|
+
* @param {number} statusCode
|
|
251
|
+
* @param {string} location
|
|
252
|
+
* @returns {RedirectableRequest}
|
|
253
|
+
*/
|
|
254
|
+
function redirectRequest(previous, statusCode, location) {
|
|
255
|
+
const url = new URL(location, previous.url);
|
|
256
|
+
const sameOrigin = url.origin === new URL(previous.url).origin;
|
|
257
|
+
let { method, body } = previous;
|
|
258
|
+
const dropped = ['host'];
|
|
259
|
+
if (!sameOrigin) dropped.push('authorization', 'cookie');
|
|
260
|
+
// Like curl and RFC 7231 §6.4.4, a 303 always turns into a GET; a 301 or 302
|
|
261
|
+
// turns only a POST into one.
|
|
262
|
+
if (
|
|
263
|
+
(statusCode === 303 && method !== 'GET' && method !== 'HEAD') ||
|
|
264
|
+
(method === 'POST' && (statusCode === 301 || statusCode === 302))
|
|
265
|
+
) {
|
|
266
|
+
method = 'GET';
|
|
267
|
+
body = undefined;
|
|
268
|
+
dropped.push('content-length', 'content-type');
|
|
269
|
+
} else if (body && !Buffer.isBuffer(body)) {
|
|
270
|
+
// A streamed body has been read by the first request and would be resent
|
|
271
|
+
// empty.
|
|
272
|
+
throw new Error(
|
|
273
|
+
`cannot follow a ${statusCode} redirect: the request body is a stream and cannot be replayed`
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
/** @type {Object<string, string>} */
|
|
277
|
+
const headers = {};
|
|
278
|
+
for (const [name, value] of Object.entries(previous.headers)) {
|
|
279
|
+
if (!dropped.includes(name.toLowerCase())) headers[name] = value;
|
|
280
|
+
}
|
|
281
|
+
return { url: url.href, method, headers, body }
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @param {object} options
|
|
286
|
+
* @returns {Promise<any>}
|
|
287
|
+
*/
|
|
288
|
+
function send(options) {
|
|
204
289
|
return new Promise((resolve, reject) => {
|
|
205
|
-
get(
|
|
206
|
-
|
|
207
|
-
...fetchOptions,
|
|
208
|
-
url,
|
|
209
|
-
method,
|
|
210
|
-
headers,
|
|
211
|
-
agent,
|
|
212
|
-
body,
|
|
213
|
-
signal: signal ?? fetchOptions.signal,
|
|
214
|
-
},
|
|
215
|
-
(err, res) => {
|
|
216
|
-
if (err) return reject(err)
|
|
217
|
-
try {
|
|
218
|
-
const iter = fromNodeStream(res);
|
|
219
|
-
resolve({
|
|
220
|
-
url: res.url,
|
|
221
|
-
method: res.method,
|
|
222
|
-
statusCode: res.statusCode,
|
|
223
|
-
statusMessage: res.statusMessage,
|
|
224
|
-
body: iter,
|
|
225
|
-
headers: res.headers,
|
|
226
|
-
});
|
|
227
|
-
} catch (e) {
|
|
228
|
-
reject(e);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
290
|
+
get({ ...options, followRedirects: false }, (err, res) =>
|
|
291
|
+
err ? reject(err) : resolve(res)
|
|
231
292
|
);
|
|
232
293
|
})
|
|
233
294
|
}
|
|
234
295
|
|
|
296
|
+
/**
|
|
297
|
+
* @param {any} res
|
|
298
|
+
* @returns {GitHttpResponse}
|
|
299
|
+
*/
|
|
300
|
+
function toResponse(res) {
|
|
301
|
+
return {
|
|
302
|
+
url: res.url,
|
|
303
|
+
method: res.method,
|
|
304
|
+
statusCode: res.statusCode,
|
|
305
|
+
statusMessage: res.statusMessage,
|
|
306
|
+
body: fromNodeStream(res),
|
|
307
|
+
headers: res.headers,
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
235
311
|
var index = { request };
|
|
236
312
|
|
|
237
313
|
export default index;
|
package/index.cjs
CHANGED
|
@@ -1734,57 +1734,75 @@ function isValidRef(name, onelevel) {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
|
|
1736
1736
|
/*!
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1737
|
+
* The POSIX core below - `assertPath`, `normalizeStringPosix` and the body of
|
|
1738
|
+
* `normalize` - comes from path-browserify, which extracted it from Node.js.
|
|
1739
|
+
* Reformatted to this project's style (`const`/`let`, no semicolons); the
|
|
1740
|
+
* algorithm is unchanged.
|
|
1740
1741
|
*
|
|
1741
|
-
*
|
|
1742
|
+
* SPDX-License-Identifier: MIT
|
|
1743
|
+
* Copyright (c) 2013 James Halliday
|
|
1744
|
+
* Copyright Joyent, Inc. and other Node contributors.
|
|
1745
|
+
*
|
|
1746
|
+
* @see https://github.com/browserify/path-browserify
|
|
1747
|
+
*
|
|
1748
|
+
* The Windows handling is this project's own, added in #2302. path-browserify
|
|
1749
|
+
* is the POSIX part of `path` only, so `normalize` and `join` are wrapped with:
|
|
1742
1750
|
* - Backslashes are normalised to forward slashes before processing.
|
|
1743
1751
|
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
|
1744
1752
|
* normalisation, so absolute Windows paths are handled correctly.
|
|
1745
|
-
* -
|
|
1753
|
+
* - A drive-letter argument passed to join() resets the accumulated path,
|
|
1746
1754
|
* matching Node behaviour and handling worktree gitdir paths properly.
|
|
1747
1755
|
*
|
|
1748
1756
|
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
|
1749
1757
|
* backslashes are normalised to forward slashes and then collapsed by
|
|
1750
|
-
*
|
|
1758
|
+
* normalizeStringPosix, losing the UNC root. Git on Windows works with
|
|
1751
1759
|
* drive-letter paths, so this is not expected to be a practical issue.
|
|
1752
1760
|
*/
|
|
1753
1761
|
|
|
1754
|
-
function
|
|
1762
|
+
function assertPath(path) {
|
|
1763
|
+
if (typeof path !== 'string') {
|
|
1764
|
+
throw new TypeError(
|
|
1765
|
+
'Path must be a string. Received ' + JSON.stringify(path)
|
|
1766
|
+
)
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// Resolves . and .. elements in a path with directory names
|
|
1771
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
1755
1772
|
let res = '';
|
|
1756
1773
|
let lastSegmentLength = 0;
|
|
1757
1774
|
let lastSlash = -1;
|
|
1758
1775
|
let dots = 0;
|
|
1759
|
-
let
|
|
1776
|
+
let code;
|
|
1760
1777
|
for (let i = 0; i <= path.length; ++i) {
|
|
1761
|
-
if (i < path.length)
|
|
1762
|
-
else if (
|
|
1763
|
-
else
|
|
1764
|
-
|
|
1765
|
-
if (char === '/') {
|
|
1778
|
+
if (i < path.length) code = path.charCodeAt(i);
|
|
1779
|
+
else if (code === 47 /* / */) break
|
|
1780
|
+
else code = 47; /* / */
|
|
1781
|
+
if (code === 47 /* / */) {
|
|
1766
1782
|
if (lastSlash === i - 1 || dots === 1) {
|
|
1767
1783
|
// NOOP
|
|
1768
|
-
} else if (dots === 2) {
|
|
1784
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
1769
1785
|
if (
|
|
1770
1786
|
res.length < 2 ||
|
|
1771
1787
|
lastSegmentLength !== 2 ||
|
|
1772
|
-
res.
|
|
1773
|
-
res.
|
|
1788
|
+
res.charCodeAt(res.length - 1) !== 46 /* . */ ||
|
|
1789
|
+
res.charCodeAt(res.length - 2) !== 46 /* . */
|
|
1774
1790
|
) {
|
|
1775
1791
|
if (res.length > 2) {
|
|
1776
1792
|
const lastSlashIndex = res.lastIndexOf('/');
|
|
1777
|
-
if (lastSlashIndex
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1793
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
1794
|
+
if (lastSlashIndex === -1) {
|
|
1795
|
+
res = '';
|
|
1796
|
+
lastSegmentLength = 0;
|
|
1797
|
+
} else {
|
|
1798
|
+
res = res.slice(0, lastSlashIndex);
|
|
1799
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
1800
|
+
}
|
|
1801
|
+
lastSlash = i;
|
|
1802
|
+
dots = 0;
|
|
1803
|
+
continue
|
|
1783
1804
|
}
|
|
1784
|
-
|
|
1785
|
-
dots = 0;
|
|
1786
|
-
continue
|
|
1787
|
-
} else if (res.length !== 0) {
|
|
1805
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
1788
1806
|
res = '';
|
|
1789
1807
|
lastSegmentLength = 0;
|
|
1790
1808
|
lastSlash = i;
|
|
@@ -1792,8 +1810,9 @@ function normalizeString(path, aar) {
|
|
|
1792
1810
|
continue
|
|
1793
1811
|
}
|
|
1794
1812
|
}
|
|
1795
|
-
if (
|
|
1796
|
-
|
|
1813
|
+
if (allowAboveRoot) {
|
|
1814
|
+
if (res.length > 0) res += '/..';
|
|
1815
|
+
else res = '..';
|
|
1797
1816
|
lastSegmentLength = 2;
|
|
1798
1817
|
}
|
|
1799
1818
|
} else {
|
|
@@ -1803,7 +1822,7 @@ function normalizeString(path, aar) {
|
|
|
1803
1822
|
}
|
|
1804
1823
|
lastSlash = i;
|
|
1805
1824
|
dots = 0;
|
|
1806
|
-
} else if (
|
|
1825
|
+
} else if (code === 46 /* . */ && dots !== -1) {
|
|
1807
1826
|
++dots;
|
|
1808
1827
|
} else {
|
|
1809
1828
|
dots = -1;
|
|
@@ -1821,7 +1840,9 @@ function getWindowsDrivePrefix(path) {
|
|
|
1821
1840
|
}
|
|
1822
1841
|
|
|
1823
1842
|
function normalize(path) {
|
|
1824
|
-
|
|
1843
|
+
assertPath(path);
|
|
1844
|
+
|
|
1845
|
+
if (path.length === 0) return '.'
|
|
1825
1846
|
|
|
1826
1847
|
// Normalise backslashes to forward slashes before any other processing.
|
|
1827
1848
|
path = path.replace(/\\/g, '/');
|
|
@@ -1829,26 +1850,19 @@ function normalize(path) {
|
|
|
1829
1850
|
const drivePrefix = getWindowsDrivePrefix(path);
|
|
1830
1851
|
// isAbsolute: Unix root ('/foo') OR Windows drive+slash ('C:/foo').
|
|
1831
1852
|
const isAbsolute =
|
|
1832
|
-
path
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
//
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1853
|
+
path.charCodeAt(0) === 47 /* / */ ||
|
|
1854
|
+
(drivePrefix !== null && path.charCodeAt(2) === 47); /* / */
|
|
1855
|
+
const trailingSeparator = path.charCodeAt(path.length - 1) === 47; /* / */
|
|
1856
|
+
|
|
1857
|
+
// Strip the drive prefix before normalizing so that the core algorithm only
|
|
1858
|
+
// ever sees a plain POSIX-style string.
|
|
1859
|
+
let normalized = normalizeStringPosix(
|
|
1860
|
+
drivePrefix ? path.slice(2) : path,
|
|
1861
|
+
!isAbsolute
|
|
1862
|
+
);
|
|
1840
1863
|
|
|
1841
|
-
if (
|
|
1842
|
-
|
|
1843
|
-
? isAbsolute
|
|
1844
|
-
? drivePrefix + '/'
|
|
1845
|
-
: drivePrefix
|
|
1846
|
-
: isAbsolute
|
|
1847
|
-
? '/'
|
|
1848
|
-
: '.';
|
|
1849
|
-
return trailingSeparator && !isAbsolute ? root + '/' : root
|
|
1850
|
-
}
|
|
1851
|
-
if (trailingSeparator) normalized += '/';
|
|
1864
|
+
if (normalized.length === 0 && !isAbsolute) normalized = '.';
|
|
1865
|
+
if (normalized.length > 0 && trailingSeparator) normalized += '/';
|
|
1852
1866
|
|
|
1853
1867
|
if (drivePrefix) {
|
|
1854
1868
|
return isAbsolute
|
|
@@ -1862,19 +1876,21 @@ function join(...args) {
|
|
|
1862
1876
|
if (args.length === 0) return '.'
|
|
1863
1877
|
let joined;
|
|
1864
1878
|
for (let i = 0; i < args.length; ++i) {
|
|
1879
|
+
assertPath(args[i]);
|
|
1865
1880
|
// Normalise separators before processing.
|
|
1866
1881
|
const arg = args[i].replace(/\\/g, '/');
|
|
1867
1882
|
if (arg.length === 0) continue
|
|
1868
1883
|
|
|
1869
1884
|
// A Windows drive-letter path (e.g. "C:/worktrees/foo") cannot be
|
|
1870
1885
|
// meaningfully appended to any base, so it resets the accumulator.
|
|
1871
|
-
// Unix absolute paths (leading '/') are NOT reset here
|
|
1886
|
+
// Unix absolute paths (leading '/') are NOT reset here - that would be
|
|
1872
1887
|
// path.resolve() semantics; path.join('foo', '/bar') must yield 'foo/bar'.
|
|
1873
1888
|
if (/^[a-zA-Z]:\//.test(arg)) {
|
|
1874
1889
|
joined = arg;
|
|
1890
|
+
} else if (joined === undefined) {
|
|
1891
|
+
joined = arg;
|
|
1875
1892
|
} else {
|
|
1876
|
-
|
|
1877
|
-
else joined += '/' + arg;
|
|
1893
|
+
joined += '/' + arg;
|
|
1878
1894
|
}
|
|
1879
1895
|
}
|
|
1880
1896
|
if (joined === undefined) return '.'
|
|
@@ -10425,8 +10441,8 @@ function filterCapabilities(server, client) {
|
|
|
10425
10441
|
|
|
10426
10442
|
const pkg = {
|
|
10427
10443
|
name: 'isomorphic-git',
|
|
10428
|
-
version: '1.44.
|
|
10429
|
-
agent: 'git/isomorphic-git@1.44.
|
|
10444
|
+
version: '1.44.17',
|
|
10445
|
+
agent: 'git/isomorphic-git@1.44.17',
|
|
10430
10446
|
};
|
|
10431
10447
|
|
|
10432
10448
|
class FIFO {
|