@argos-ci/core 6.8.3 → 6.8.4
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/dist/index.mjs +30 -22
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -76,6 +76,7 @@ function gitMergeBase(input) {
|
|
|
76
76
|
try {
|
|
77
77
|
return execFileSync("git", [
|
|
78
78
|
"merge-base",
|
|
79
|
+
"--end-of-options",
|
|
79
80
|
input.head,
|
|
80
81
|
input.base
|
|
81
82
|
]).toString().trim();
|
|
@@ -103,14 +104,20 @@ function checkIsGitLockError(error) {
|
|
|
103
104
|
return output.includes(".lock': File exists") || output.includes("Another git process seems to be running");
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
|
-
* Run `git fetch` with the given
|
|
107
|
+
* Run `git fetch` from origin with the given options and refs (or refspecs).
|
|
107
108
|
*
|
|
108
109
|
* Retries on lock contention (`.git/shallow.lock` "File exists") with an
|
|
109
110
|
* exponential backoff, since this is usually a transient conflict with another
|
|
110
111
|
* git process and resolves once that process releases the lock.
|
|
111
112
|
*/
|
|
112
|
-
function runGitFetch(
|
|
113
|
-
return pRetry(() => execFileAsync("git", [
|
|
113
|
+
function runGitFetch(input) {
|
|
114
|
+
return pRetry(() => execFileAsync("git", [
|
|
115
|
+
"fetch",
|
|
116
|
+
...input.options,
|
|
117
|
+
"--end-of-options",
|
|
118
|
+
"origin",
|
|
119
|
+
...input.refs
|
|
120
|
+
]), {
|
|
114
121
|
retries: 3,
|
|
115
122
|
minTimeout: 500,
|
|
116
123
|
shouldRetry: ({ error }) => checkIsGitLockError(error),
|
|
@@ -123,14 +130,15 @@ function runGitFetch(args) {
|
|
|
123
130
|
* Run git fetch with a specific ref and depth.
|
|
124
131
|
*/
|
|
125
132
|
async function gitFetch(input) {
|
|
126
|
-
await runGitFetch(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
await runGitFetch({
|
|
134
|
+
options: [
|
|
135
|
+
"--force",
|
|
136
|
+
"--update-head-ok",
|
|
137
|
+
"--depth",
|
|
138
|
+
String(input.depth)
|
|
139
|
+
],
|
|
140
|
+
refs: [`${input.ref}:${input.target}`]
|
|
141
|
+
});
|
|
134
142
|
}
|
|
135
143
|
/**
|
|
136
144
|
* Check if an error is an exec error that includes stderr.
|
|
@@ -154,6 +162,7 @@ function checkLocalRefExists(ref) {
|
|
|
154
162
|
"rev-parse",
|
|
155
163
|
"--verify",
|
|
156
164
|
"--quiet",
|
|
165
|
+
"--end-of-options",
|
|
157
166
|
`${ref}^{commit}`
|
|
158
167
|
]);
|
|
159
168
|
return true;
|
|
@@ -241,7 +250,7 @@ async function getMergeBaseCommitSha$2(input) {
|
|
|
241
250
|
function listShas(path, maxCount) {
|
|
242
251
|
const args = ["log", "--format=%H"];
|
|
243
252
|
if (maxCount) args.push(`--max-count=${maxCount}`);
|
|
244
|
-
args.push(path);
|
|
253
|
+
args.push("--end-of-options", path);
|
|
245
254
|
return execFileSync("git", args).toString().trim().split("\n");
|
|
246
255
|
}
|
|
247
256
|
/**
|
|
@@ -256,11 +265,10 @@ function listShas(path, maxCount) {
|
|
|
256
265
|
async function listAncestorCommits$1(input) {
|
|
257
266
|
const depth = input.limit + 1;
|
|
258
267
|
try {
|
|
259
|
-
await runGitFetch(
|
|
260
|
-
`--depth=${depth}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
]);
|
|
268
|
+
await runGitFetch({
|
|
269
|
+
options: [`--depth=${depth}`],
|
|
270
|
+
refs: [input.sha]
|
|
271
|
+
});
|
|
264
272
|
} catch (error) {
|
|
265
273
|
debug(`Failed to deepen history for ${input.sha}, using local history`, getGitErrorOutput(error));
|
|
266
274
|
}
|
|
@@ -284,11 +292,10 @@ async function getCommitParents(sha) {
|
|
|
284
292
|
const localParents = readCommitParents(sha);
|
|
285
293
|
if (localParents?.length) return localParents;
|
|
286
294
|
try {
|
|
287
|
-
await runGitFetch(
|
|
288
|
-
"--depth=2",
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
]);
|
|
295
|
+
await runGitFetch({
|
|
296
|
+
options: ["--depth=2"],
|
|
297
|
+
refs: [sha]
|
|
298
|
+
});
|
|
292
299
|
} catch (error) {
|
|
293
300
|
debug(`Failed to deepen history for ${sha}, using local history`, getGitErrorOutput(error));
|
|
294
301
|
return localParents;
|
|
@@ -308,6 +315,7 @@ function readCommitParents(sha) {
|
|
|
308
315
|
"--parents",
|
|
309
316
|
"-n",
|
|
310
317
|
"1",
|
|
318
|
+
"--end-of-options",
|
|
311
319
|
sha,
|
|
312
320
|
"--"
|
|
313
321
|
], { stdio: [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/core",
|
|
3
3
|
"description": "Node.js SDK for visual testing with Argos.",
|
|
4
|
-
"version": "6.8.
|
|
4
|
+
"version": "6.8.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"lint": "eslint .",
|
|
69
69
|
"test": "vitest"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "212ed2c37ce532dd32c87ac685b55e2ab6e154c4"
|
|
72
72
|
}
|