next-issue 17.0.3 → 17.0.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/shared/handover.mjs
CHANGED
|
@@ -207,7 +207,9 @@ export async function claimedError(context, log, issue, state, error, started) {
|
|
|
207
207
|
log.event('hand-over.error', { error: message(failure) });
|
|
208
208
|
}
|
|
209
209
|
logIssueError(log, error, started);
|
|
210
|
-
|
|
210
|
+
if (state.fresh !== true) {
|
|
211
|
+
await cleanUp(context, log, state.branch);
|
|
212
|
+
}
|
|
211
213
|
const report = {
|
|
212
214
|
...issueReport(issue.number, 'error', state, started, reason),
|
|
213
215
|
...(handedOver ? { handedOver } : {}),
|
package/dist/shared/state.mjs
CHANGED
|
@@ -77,7 +77,8 @@ function isState(value) {
|
|
|
77
77
|
isOptional(value.handedOver, 'boolean') &&
|
|
78
78
|
(value.pendingHandOver === undefined || isPending(value.pendingHandOver)) &&
|
|
79
79
|
isOptional(value.closing, 'boolean') &&
|
|
80
|
-
isOptional(value.halted, 'boolean')
|
|
80
|
+
isOptional(value.halted, 'boolean') &&
|
|
81
|
+
isOptional(value.fresh, 'boolean'));
|
|
81
82
|
}
|
|
82
83
|
export async function savedIssues(repo) {
|
|
83
84
|
const names = (await unlessMissing(() => readdir(stateDir(repo.root)))) ?? [];
|
package/dist/shared/worktree.mjs
CHANGED
|
@@ -15,7 +15,7 @@ export async function addWorktree(repo, issue, branch, base, remote, start) {
|
|
|
15
15
|
const baseUpdated = await fastForwardBase(repo, base, remote);
|
|
16
16
|
await git(repo.root, ['worktree', 'prune']);
|
|
17
17
|
await releaseFromHunt(repo, branch);
|
|
18
|
-
await
|
|
18
|
+
await refuseOwnWorktree(repo, issue, branch, start);
|
|
19
19
|
const pushed = await hasBranch(repo, upstream, '--remotes');
|
|
20
20
|
const existing = await findWorktree(repo, branch);
|
|
21
21
|
const path = existing ?? worktreePath(repo, issue);
|
|
@@ -70,11 +70,14 @@ export async function findWorktree(repo, branch) {
|
|
|
70
70
|
}
|
|
71
71
|
return found.path;
|
|
72
72
|
}
|
|
73
|
-
async function
|
|
73
|
+
async function refuseOwnWorktree(repo, issue, branch, start) {
|
|
74
74
|
const found = await holder(repo, branch);
|
|
75
75
|
if (found?.main) {
|
|
76
76
|
throw new Error(`the main worktree at ${found.path} has branch ${branch} checked out, so the issue cannot have its own worktree; check out another branch there and try again`);
|
|
77
77
|
}
|
|
78
|
+
if (start && found !== undefined && !(await samePath(found.path, worktreePath(repo, issue)))) {
|
|
79
|
+
throw new Error(`the worktree at ${found.path} has branch ${branch} checked out, so the issue cannot have its own worktree; check out another branch there and try again`);
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
82
|
async function releaseFromHunt(repo, branch) {
|
|
80
83
|
const found = await holder(repo, branch);
|
|
@@ -83,8 +86,11 @@ async function releaseFromHunt(repo, branch) {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
async function isHunt(repo, path) {
|
|
89
|
+
return samePath(path, huntPath(repo));
|
|
90
|
+
}
|
|
91
|
+
async function samePath(first, second) {
|
|
86
92
|
const real = (target) => realpath(target).catch(() => target);
|
|
87
|
-
return (await real(
|
|
93
|
+
return (await real(first)) === (await real(second));
|
|
88
94
|
}
|
|
89
95
|
async function holder(repo, branch) {
|
|
90
96
|
const list = await git(repo.root, ['worktree', 'list', '--porcelain']);
|
package/dist/worker/open-job.mjs
CHANGED
|
@@ -18,6 +18,10 @@ export async function openJob(context, issue, log, state, start, handedOver, pen
|
|
|
18
18
|
? await log.step('reply', {}, () => handOverReply(context, issue.number, pending))
|
|
19
19
|
: [];
|
|
20
20
|
const worktree = await openWorktree(context, issue, log, branch, start);
|
|
21
|
+
if (state.fresh === true) {
|
|
22
|
+
delete state.fresh;
|
|
23
|
+
await writeState(repo, state);
|
|
24
|
+
}
|
|
21
25
|
return {
|
|
22
26
|
context,
|
|
23
27
|
issue,
|
package/dist/worker/pipeline.mjs
CHANGED
|
@@ -41,7 +41,7 @@ export async function processIssue(context, issue, slot) {
|
|
|
41
41
|
try {
|
|
42
42
|
report = closing
|
|
43
43
|
? await finishClosing(context, issue, log, state, started)
|
|
44
|
-
: await work(context, issue, log, state,
|
|
44
|
+
: await work(context, issue, log, state, state.fresh === true, handedOver, saved?.pendingHandOver, slot);
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
47
|
if (!runStopped()) {
|
|
@@ -66,7 +66,7 @@ function wasHandedOver(context, issue, saved) {
|
|
|
66
66
|
}
|
|
67
67
|
function startState(issue, saved, handedOver) {
|
|
68
68
|
if (saved === undefined) {
|
|
69
|
-
return newState(issue.number, branchName(issue.number));
|
|
69
|
+
return { ...newState(issue.number, branchName(issue.number)), fresh: true };
|
|
70
70
|
}
|
|
71
71
|
const { pendingHandOver: _pending, ...rest } = saved;
|
|
72
72
|
return handedOver ? resetState(saved) : rest;
|