next-issue 6.6.29 → 6.6.30
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 +5 -3
- package/dist/conflict.mjs +1 -1
- package/dist/git-merge.mjs +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,9 +117,11 @@ the run handles one issue. For each issue:
|
|
|
117
117
|
the change. When git merges the base cleanly, no agent runs. When git
|
|
118
118
|
reports conflicted files, the fixer gets the list from the check budget,
|
|
119
119
|
`maxCiFixes`, removes the conflict markers, and the harness commits the
|
|
120
|
-
merge.
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
merge. A merge that the fixer commits itself counts only when the branch
|
|
121
|
+
then holds the base and the listed files hold no conflict marker. With the
|
|
122
|
+
budget used up, or when the fixer leaves a conflict marker or the merge
|
|
123
|
+
unresolved, aborts the merge, or fails, the harness undoes the merge and
|
|
124
|
+
hands the issue to a person with the reason `merge conflict`. The
|
|
123
125
|
harness then pushes the commit to the base branch, without force. A push
|
|
124
126
|
that the remote refuses, for example because the base moved, starts the
|
|
125
127
|
rebase again, three times at most. When the push fails, the harness
|
package/dist/conflict.mjs
CHANGED
|
@@ -48,7 +48,7 @@ async function resolve(job, before, files) {
|
|
|
48
48
|
try {
|
|
49
49
|
const text = files.length > 0 ? await fixConflict(job, files) : '';
|
|
50
50
|
const subject = parseCommitSubject(text, `chore: merge ${config.remote}/${context.base}`);
|
|
51
|
-
return await commitWork(job, before, subject, 'fixer', (cwd, message) => ports.commitMerge(cwd, files, message));
|
|
51
|
+
return await commitWork(job, before, subject, 'fixer', (cwd, message) => ports.commitMerge(cwd, { before, base: context.base, remote: config.remote, files }, message));
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
await ports.abortMerge(worktree, before);
|
package/dist/git-merge.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { run, succeeded } from './exec.mjs';
|
|
3
3
|
import { readTextOrEmpty } from './files.mjs';
|
|
4
4
|
import { commitEverything } from './git-commit.mjs';
|
|
5
|
-
import { fetchBase, git, resetHard, succeeds } from './git.mjs';
|
|
5
|
+
import { fetchBase, git, isAncestor, remoteRef, resetHard, succeeds } from './git.mjs';
|
|
6
6
|
import { lines } from './text.mjs';
|
|
7
7
|
export async function startMerge(cwd, base, remote) {
|
|
8
8
|
const target = await fetchBase(cwd, base, remote);
|
|
@@ -21,13 +21,23 @@ async function merging(cwd) {
|
|
|
21
21
|
return succeeds(cwd, ['rev-parse', '--quiet', '--verify', 'MERGE_HEAD']);
|
|
22
22
|
}
|
|
23
23
|
const CONFLICT_MARKER = /^(?:<{7}|>{7})(?: |$)/m;
|
|
24
|
-
export async function commitMerge(cwd,
|
|
25
|
-
if (!(await merging(cwd))
|
|
24
|
+
export async function commitMerge(cwd, merge, message) {
|
|
25
|
+
if (!(await merging(cwd))) {
|
|
26
|
+
await refuseUnmerged(cwd, merge);
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (await hasConflictMarkers(cwd, merge.files)) {
|
|
26
30
|
return false;
|
|
27
31
|
}
|
|
28
32
|
await commitEverything(cwd, message);
|
|
29
33
|
return true;
|
|
30
34
|
}
|
|
35
|
+
async function refuseUnmerged(cwd, merge) {
|
|
36
|
+
const holdsBase = await isAncestor(cwd, remoteRef(merge.remote, merge.base), 'HEAD');
|
|
37
|
+
if (!holdsBase || (await hasConflictMarkers(cwd, merge.files))) {
|
|
38
|
+
await resetHard(cwd, merge.before);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
31
41
|
async function hasConflictMarkers(cwd, files) {
|
|
32
42
|
for (const file of files) {
|
|
33
43
|
const text = await readTextOrEmpty(join(cwd, file));
|