next-issue 2.5.9 → 2.5.10
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/README.md +7 -6
- package/dist/git.mjs +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,12 +30,13 @@ and exits with code 1. For each issue:
|
|
|
30
30
|
state keeps the branch name that the state holds, and a worktree that
|
|
31
31
|
holds that branch already stays in use. A branch that exists on the
|
|
32
32
|
remote is the start, and a local branch that fell behind the remote is
|
|
33
|
-
fast-forwarded.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
fast-forwarded. A local branch that the remote does not hold and that has
|
|
34
|
+
no commits of its own starts again from the remote base. An issue with no
|
|
35
|
+
saved state does not reuse a local `<n>` branch: it resets that branch,
|
|
36
|
+
and any worktree that holds it, to the remote branch, or to the remote
|
|
37
|
+
base when there is none. A fast-forward of the base that is not safe
|
|
38
|
+
leaves the local base branch as it is and writes a `base.behind` event. A
|
|
39
|
+
new branch then starts from the remote base.
|
|
39
40
|
4. Let the implementer agent do the work, then commit and push. When a git
|
|
40
41
|
hook stops a commit, the agent that made the change gets the hook output,
|
|
41
42
|
fixes it, and the harness commits again. A `commit:` line in the reply of
|
package/dist/git.mjs
CHANGED
|
@@ -39,7 +39,7 @@ export async function addWorktree(repo, issue, branch, base, remote, start) {
|
|
|
39
39
|
const path = existing ?? worktreePath(repo, issue);
|
|
40
40
|
const target = pushed ? upstream : `${remote}/${base}`;
|
|
41
41
|
if (existing === undefined) {
|
|
42
|
-
const args = !start && (await
|
|
42
|
+
const args = !start && (await hasWork(repo, branch, pushed, `${remote}/${base}`))
|
|
43
43
|
? ['worktree', 'add', path, branch]
|
|
44
44
|
: ['worktree', 'add', '-B', branch, path, target];
|
|
45
45
|
await must('git', args, { cwd: repo.root });
|
|
@@ -52,6 +52,12 @@ export async function addWorktree(repo, issue, branch, base, remote, start) {
|
|
|
52
52
|
}
|
|
53
53
|
return { path, baseUpdated };
|
|
54
54
|
}
|
|
55
|
+
async function hasWork(repo, branch, pushed, base) {
|
|
56
|
+
if (!(await hasBranch(repo, branch))) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return pushed || !(await isAncestor(repo.root, branch, base));
|
|
60
|
+
}
|
|
55
61
|
async function hasBranch(repo, name, ...flags) {
|
|
56
62
|
const list = await must('git', ['branch', '--list', ...flags, name], { cwd: repo.root });
|
|
57
63
|
return list.length > 0;
|