pi-odd-worktree 2.0.0 → 3.0.0
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 +54 -311
- package/extensions/odd-worktree-tools.ts +4149 -2447
- package/lib/bash-activity.js +1164 -0
- package/lib/bash-design.js +684 -0
- package/lib/bash-destructive.js +559 -0
- package/lib/bash-frame.js +205 -0
- package/lib/card-content.js +23 -0
- package/lib/card-style.js +175 -0
- package/lib/checkout-facts.js +30 -70
- package/lib/codegraph-card-preview.js +628 -0
- package/lib/codegraph-card.js +515 -0
- package/lib/codegraph-compaction.js +76 -0
- package/lib/codegraph-daemon.js +246 -0
- package/lib/codegraph-edit-sync.js +182 -0
- package/lib/codegraph-guard-target.js +337 -0
- package/lib/codegraph-guard.js +211 -0
- package/lib/codegraph-index.js +1020 -0
- package/lib/codegraph-lock.js +607 -0
- package/lib/codegraph-mcp-config.js +134 -0
- package/lib/codegraph-mcp.js +123 -0
- package/lib/codegraph-paths.js +69 -0
- package/lib/codegraph-prompt/explore.md +11 -0
- package/lib/codegraph-prompt/fix.md +6 -0
- package/lib/codegraph-prompt/generic.md +8 -0
- package/lib/codegraph-prompt/judge.md +9 -0
- package/lib/codegraph-prompt/orchestrator.md +17 -0
- package/lib/codegraph-prompt/verify.md +10 -0
- package/lib/codegraph-prompt/worker.md +7 -0
- package/lib/codegraph-role.js +55 -0
- package/lib/codegraph-rules.js +146 -0
- package/lib/codegraph-session.js +303 -383
- package/lib/codegraph-warmup.js +139 -0
- package/lib/file-card-markdown.js +141 -0
- package/lib/file-card-resolver.js +245 -0
- package/lib/file-card.js +659 -0
- package/lib/files-index.js +387 -0
- package/lib/files-insert.js +81 -0
- package/lib/files-orders.js +326 -0
- package/lib/files-picker-view.js +1416 -0
- package/lib/files-preview.js +338 -0
- package/lib/files-scope-detail.js +171 -0
- package/lib/files-scope-view.js +507 -0
- package/lib/gh-issues.js +308 -14
- package/lib/issue-preview.js +26 -7
- package/lib/issues-bash-mutation.js +206 -0
- package/lib/issues-cache-store.js +261 -0
- package/lib/issues-section.js +710 -0
- package/lib/issues-view.js +649 -52
- package/lib/odd-prompt/odd-worktrees.md +21 -0
- package/lib/odd-worktrees-prompt.js +10 -28
- package/lib/related-issues-cache.js +210 -0
- package/lib/shell-card.js +825 -0
- package/lib/skill-odd-card.js +183 -0
- package/lib/tui-paint.js +4 -5
- package/lib/warp-create-panel.js +538 -250
- package/lib/warp-create-picker.js +56 -9
- package/lib/warp-delete-confirm.js +19 -28
- package/lib/warp-selector-view.js +160 -82
- package/lib/which-command.js +90 -0
- package/lib/worktree-card.js +267 -897
- package/lib/worktree-cards.js +383 -0
- package/lib/worktree-create.js +287 -0
- package/lib/worktree-git.js +3 -3
- package/lib/worktree-guard.js +548 -0
- package/lib/worktree-hooks.js +421 -711
- package/lib/worktree-list.js +120 -0
- package/lib/worktree-registry.js +162 -879
- package/lib/{worktree-close-herdr.js → worktree-remove.js} +9 -11
- package/lib/worktree-setup-runner.js +376 -0
- package/lib/worktree-setup.js +140 -0
- package/lib/worktree-warp-busy.js +462 -85
- package/lib/worktree-warp-sessions.js +1 -2
- package/package.json +2 -2
- package/tools/bash-activity.test.js +1419 -0
- package/tools/bash-design.test.js +1091 -0
- package/tools/bash-destructive.test.js +139 -0
- package/tools/card-content.test.js +44 -0
- package/tools/card-style.test.js +298 -0
- package/tools/codegraph-card-preview.test.js +254 -0
- package/tools/codegraph-card.test.js +1080 -0
- package/tools/codegraph-compaction.test.js +378 -0
- package/tools/codegraph-daemon.test.js +248 -0
- package/tools/codegraph-edit-sync.test.js +295 -0
- package/tools/codegraph-guard-target.test.js +174 -0
- package/tools/codegraph-guard.test.js +238 -0
- package/tools/codegraph-index.test.js +1948 -0
- package/tools/codegraph-lock.test.js +932 -0
- package/tools/codegraph-mcp-config.test.js +181 -0
- package/tools/codegraph-mcp.test.js +194 -0
- package/tools/codegraph-paths.test.js +44 -0
- package/tools/codegraph-role.test.js +30 -0
- package/tools/codegraph-rules.test.js +250 -0
- package/tools/codegraph-session.test.js +660 -391
- package/tools/codegraph-warmup.test.js +316 -0
- package/tools/commands.test.js +510 -31
- package/tools/file-card-markdown.test.js +188 -0
- package/tools/file-card.test.js +1289 -0
- package/tools/files-bridge.test.js +575 -0
- package/tools/files-command.test.js +610 -0
- package/tools/files-index.test.js +473 -0
- package/tools/files-insert.test.js +139 -0
- package/tools/files-orders.test.js +597 -0
- package/tools/files-picker-view.test.js +1871 -0
- package/tools/files-preview.test.js +452 -0
- package/tools/files-scope-detail.test.js +264 -0
- package/tools/files-scope-view.test.js +614 -0
- package/tools/fixtures/card-codegraph-outputs.js +110 -0
- package/tools/fixtures/codegraph-cli-stub.js +16 -0
- package/tools/fixtures/codegraph-init-process.js +28 -0
- package/tools/fixtures/codegraph-lock-worker.js +117 -0
- package/tools/fixtures/daemon-fake.js +98 -0
- package/tools/fixtures/daemon-mcp-server.js +39 -0
- package/tools/fixtures/daemon-warmup-worker.js +12 -0
- package/tools/fixtures/load-extension.js +136 -3
- package/tools/gh-issues-feedback.test.js +31 -7
- package/tools/gh-issues.test.js +391 -1
- package/tools/issue-preview.test.js +44 -7
- package/tools/issues-bash-mutation.test.js +101 -0
- package/tools/issues-cache-store.test.js +222 -0
- package/tools/issues-command.test.js +1512 -66
- package/tools/issues-open-guard.test.js +1096 -0
- package/tools/issues-section.test.js +4195 -0
- package/tools/issues-seed-query-regression.test.js +67 -0
- package/tools/issues-view.test.js +1489 -60
- package/tools/odd-worktrees-prompt.test.js +98 -65
- package/tools/package-surface.test.js +431 -36
- package/tools/related-issues-cache.test.js +324 -0
- package/tools/shell-card.test.js +834 -0
- package/tools/skill-odd-card.test.js +200 -0
- package/tools/t5-session-identity.test.js +44 -22
- package/tools/warp-busy-guard.test.js +2569 -308
- package/tools/warp-create-panel.test.js +499 -74
- package/tools/warp-create-picker.test.js +101 -5
- package/tools/warp-delete-confirm.test.js +49 -15
- package/tools/warp-empty-session.test.js +0 -1
- package/tools/warp-fallback-regression.test.js +533 -0
- package/tools/warp-selector-view.test.js +460 -196
- package/tools/which-command.test.js +126 -0
- package/tools/worktree-card.test.js +551 -0
- package/tools/worktree-cards.test.js +845 -0
- package/tools/worktree-changes.test.js +4 -5
- package/tools/worktree-create.test.js +489 -0
- package/tools/worktree-guard.test.js +823 -0
- package/tools/worktree-hooks.test.js +905 -0
- package/tools/worktree-list.test.js +170 -0
- package/tools/worktree-registry.test.js +89 -230
- package/tools/worktree-remove-async.test.js +318 -0
- package/tools/worktree-setup-runner.test.js +276 -0
- package/tools/worktree-setup.test.js +140 -0
- package/tools/worktree-tools.test.js +477 -93
- package/lib/codegraph-commands.js +0 -165
- package/lib/odd-prompt/odd-worktrees.with-codegraph.md +0 -19
- package/lib/odd-prompt/odd-worktrees.without-codegraph.md +0 -15
- package/lib/worktree-model-result.js +0 -291
- package/tools/codegraph-commands.test.js +0 -371
- package/tools/herdr-free-create.test.js +0 -161
- package/tools/worktree-close-herdr-async.test.js +0 -204
- package/tools/worktree-odd-migration.test.js +0 -224
- package/tools/worktree-registry-cache.test.js +0 -163
- package/tools/worktree-registry-odd.test.js +0 -231
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// T3 (files-picker S9): `lib/files-scope-detail.js` — the scope step's data.
|
|
3
|
+
//
|
|
4
|
+
// Contract under test, as observable output only: `main` first and then the
|
|
5
|
+
// other checkouts by recency (stable ties, input untouched); one
|
|
6
|
+
// `rev-list --left-right --count` line parsed as behind/ahead or rejected whole;
|
|
7
|
+
// the `±n files` cell singular at one; the focused scope's line with the last
|
|
8
|
+
// commit subject first, then the count, the age and the distance from the
|
|
9
|
+
// comparison ref, with every zero or absent field unpainted; the age field
|
|
10
|
+
// reading `33s ago` rather than a bare `33s` (S42) in the same s/m/h/d units and
|
|
11
|
+
// from the same fixed-at-open clock; and the two fixed argv reads behind the line
|
|
12
|
+
// with every Git failure degrading to an absent field instead of throwing.
|
|
13
|
+
|
|
14
|
+
const { test, describe } = require('node:test');
|
|
15
|
+
const assert = require('node:assert/strict');
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
LOCAL_MAIN,
|
|
19
|
+
REMOTE_MAIN,
|
|
20
|
+
countCell,
|
|
21
|
+
loadScopeDetail,
|
|
22
|
+
orderScopes,
|
|
23
|
+
parseAheadBehind,
|
|
24
|
+
scopeDetailLine,
|
|
25
|
+
} = require('../lib/files-scope-detail.js');
|
|
26
|
+
|
|
27
|
+
const NOW = 1_700_000_000_000;
|
|
28
|
+
const MINUTE = 60_000;
|
|
29
|
+
const HOUR = 60 * MINUTE;
|
|
30
|
+
const DAY = 24 * HOUR;
|
|
31
|
+
|
|
32
|
+
function scope(overrides = {}) {
|
|
33
|
+
return { root: '/repo', label: 'main', kind: 'main', lastModifiedMs: 0, ...overrides };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('orderScopes (S9)', () => {
|
|
37
|
+
test('main keeps the first row even when a worktree is newer', () => {
|
|
38
|
+
const ordered = orderScopes([
|
|
39
|
+
scope({ root: '/w/new', label: 'new', kind: 'worktree', lastModifiedMs: 900 }),
|
|
40
|
+
scope({ root: '/repo', label: 'main', kind: 'main', lastModifiedMs: 1 }),
|
|
41
|
+
scope({ root: '/w/old', label: 'old', kind: 'worktree', lastModifiedMs: 10 }),
|
|
42
|
+
]);
|
|
43
|
+
assert.deepEqual(ordered.map((entry) => entry.label), ['main', 'new', 'old']);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('worktrees follow by lastModifiedMs descending, ties in input order', () => {
|
|
47
|
+
const ordered = orderScopes([
|
|
48
|
+
scope({ root: '/w/a', label: 'a', kind: 'worktree', lastModifiedMs: 300 }),
|
|
49
|
+
scope({ root: '/w/b', label: 'b', kind: 'worktree', lastModifiedMs: 300 }),
|
|
50
|
+
scope({ root: '/w/c', label: 'c', kind: 'worktree', lastModifiedMs: 500 }),
|
|
51
|
+
scope({ root: '/w/d', label: 'd', kind: 'worktree' }),
|
|
52
|
+
]);
|
|
53
|
+
assert.deepEqual(ordered.map((entry) => entry.label), ['c', 'a', 'b', 'd']);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('leaves the input array and its entries untouched and returns the same objects', () => {
|
|
57
|
+
const input = [
|
|
58
|
+
scope({ root: '/w/a', label: 'a', kind: 'worktree', lastModifiedMs: 1 }),
|
|
59
|
+
scope({ root: '/repo', label: 'main', kind: 'main', lastModifiedMs: 2 }),
|
|
60
|
+
];
|
|
61
|
+
const ordered = orderScopes(input);
|
|
62
|
+
assert.deepEqual(input.map((entry) => entry.label), ['a', 'main']);
|
|
63
|
+
assert.equal(ordered[0], input[1]);
|
|
64
|
+
assert.equal(ordered[1], input[0]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('an empty or non-array input is an empty ordering', () => {
|
|
68
|
+
assert.deepEqual(orderScopes([]), []);
|
|
69
|
+
assert.deepEqual(orderScopes(null), []);
|
|
70
|
+
assert.deepEqual(orderScopes(undefined), []);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('parseAheadBehind (S9)', () => {
|
|
75
|
+
test('reads <behind> <ahead> from one left-right count line', () => {
|
|
76
|
+
assert.deepEqual(parseAheadBehind('3\t2\n'), { behind: 3, ahead: 2 });
|
|
77
|
+
assert.deepEqual(parseAheadBehind('0 0'), { behind: 0, ahead: 0 });
|
|
78
|
+
assert.deepEqual(parseAheadBehind(' 12 7 '), { behind: 12, ahead: 7 });
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('anything that is not exactly two whole counts is unparsable', () => {
|
|
82
|
+
for (const value of ['', '2', '1 2 3', '-1 2', '1 -2', 'a 2', '1 2x', '1.5 2', '\n']) {
|
|
83
|
+
assert.equal(parseAheadBehind(value), undefined, JSON.stringify(value));
|
|
84
|
+
}
|
|
85
|
+
assert.equal(parseAheadBehind(null), undefined);
|
|
86
|
+
assert.equal(parseAheadBehind(undefined), undefined);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('countCell (S9)', () => {
|
|
91
|
+
test('paints the glyph and the noun, singular at one', () => {
|
|
92
|
+
assert.equal(countCell(1), '±1 file');
|
|
93
|
+
assert.equal(countCell(0), '±0 files');
|
|
94
|
+
assert.equal(countCell(7), '±7 files');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('scopeDetailLine (S9)', () => {
|
|
99
|
+
test('the last commit subject leads, then the count, the age and the distances', () => {
|
|
100
|
+
const line = scopeDetailLine({
|
|
101
|
+
lastCommitSubject: 'add the scope step',
|
|
102
|
+
changedFiles: 3,
|
|
103
|
+
lastModifiedMs: NOW - 5 * MINUTE,
|
|
104
|
+
ahead: 2,
|
|
105
|
+
behind: 1,
|
|
106
|
+
comparison: 'main',
|
|
107
|
+
}, NOW);
|
|
108
|
+
assert.equal(line, 'add the scope step · ±3 files · 5m ago · ↑2 main · ↓1 main');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('the main row names the remote ref it is measured against', () => {
|
|
112
|
+
const line = scopeDetailLine({
|
|
113
|
+
lastCommitSubject: 'bump deps',
|
|
114
|
+
changedFiles: 1,
|
|
115
|
+
lastModifiedMs: NOW - 2 * HOUR,
|
|
116
|
+
ahead: 0,
|
|
117
|
+
behind: 4,
|
|
118
|
+
comparison: REMOTE_MAIN,
|
|
119
|
+
}, NOW);
|
|
120
|
+
assert.equal(line, 'bump deps · ±1 file · 2h ago · ↓4 origin/main');
|
|
121
|
+
assert.equal(REMOTE_MAIN, 'origin/main');
|
|
122
|
+
assert.equal(LOCAL_MAIN, 'main');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('a zero or absent field is not painted', () => {
|
|
126
|
+
assert.equal(scopeDetailLine({}, NOW), '');
|
|
127
|
+
assert.equal(scopeDetailLine({
|
|
128
|
+
lastCommitSubject: 'only a subject',
|
|
129
|
+
changedFiles: 0,
|
|
130
|
+
lastModifiedMs: 0,
|
|
131
|
+
ahead: 0,
|
|
132
|
+
behind: 0,
|
|
133
|
+
comparison: 'main',
|
|
134
|
+
}, NOW), 'only a subject');
|
|
135
|
+
assert.equal(scopeDetailLine({ changedFiles: 0 }, NOW), '');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('an unknown comparison never claims a distance', () => {
|
|
139
|
+
assert.equal(scopeDetailLine({ changedFiles: 2, ahead: 3, behind: 1 }, NOW), '±2 files');
|
|
140
|
+
assert.equal(scopeDetailLine({ changedFiles: 2, ahead: 3, behind: 1, comparison: ' ' }, NOW), '±2 files');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('ages use s/m/h/d units of the clock read once at open, suffixed `ago` (S42)', () => {
|
|
144
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: NOW - 30_000 }, NOW), '30s ago');
|
|
145
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: NOW - 3 * MINUTE }, NOW), '3m ago');
|
|
146
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: NOW - 3 * HOUR }, NOW), '3h ago');
|
|
147
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: NOW - 3 * DAY }, NOW), '3d ago');
|
|
148
|
+
// Same units, same fixed-at-open clock: the label grows with `nowMs` alone.
|
|
149
|
+
const modified = NOW - 33_000;
|
|
150
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: modified }, NOW), '33s ago');
|
|
151
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: modified }, NOW + 27_000), '1m ago');
|
|
152
|
+
assert.equal(scopeDetailLine({ lastModifiedMs: modified }, NOW + DAY), '1d ago');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('the whole line pins the age as `33s ago`, never a bare `33s` (S42)', () => {
|
|
156
|
+
const line = scopeDetailLine({
|
|
157
|
+
lastCommitSubject: 'land the scope step',
|
|
158
|
+
changedFiles: 14,
|
|
159
|
+
lastModifiedMs: NOW - 33_000,
|
|
160
|
+
ahead: 13,
|
|
161
|
+
behind: 0,
|
|
162
|
+
comparison: 'origin/main',
|
|
163
|
+
}, NOW);
|
|
164
|
+
assert.equal(line, 'land the scope step · ±14 files · 33s ago · ↑13 origin/main');
|
|
165
|
+
assert.ok(line.includes(' · 33s ago · '), 'the age field names what the number measures');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('no age field when the last modification is absent or non-positive (S42)', () => {
|
|
169
|
+
for (const lastModifiedMs of [undefined, null, 0, -1, -33_000, Number.NaN, 'nope', {}]) {
|
|
170
|
+
assert.equal(
|
|
171
|
+
scopeDetailLine({ lastCommitSubject: 'subject', changedFiles: 2, lastModifiedMs }, NOW),
|
|
172
|
+
'subject · ±2 files',
|
|
173
|
+
JSON.stringify(lastModifiedMs),
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('a blank subject and hostile input paint nothing instead of throwing', () => {
|
|
179
|
+
assert.equal(scopeDetailLine({ lastCommitSubject: ' ' }, NOW), '');
|
|
180
|
+
assert.equal(scopeDetailLine(null, NOW), '');
|
|
181
|
+
assert.equal(scopeDetailLine(undefined, NOW), '');
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe('loadScopeDetail (S9)', () => {
|
|
186
|
+
function runner(answers) {
|
|
187
|
+
const calls = [];
|
|
188
|
+
const run = async (args, options) => {
|
|
189
|
+
calls.push({ args, options });
|
|
190
|
+
const answer = answers[args[0]] || { status: 1, stdout: '', stderr: 'nope' };
|
|
191
|
+
if (typeof answer === 'function') return answer();
|
|
192
|
+
return answer;
|
|
193
|
+
};
|
|
194
|
+
return { run, calls };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
test('runs the two fixed argv reads in the scope cwd and composes the detail', async () => {
|
|
198
|
+
const { run, calls } = runner({
|
|
199
|
+
'rev-list': { status: 0, stdout: '1\t2\n', stderr: '' },
|
|
200
|
+
log: { status: 0, stdout: 'add the scope step\n\nbody\n', stderr: '' },
|
|
201
|
+
});
|
|
202
|
+
const detail = await loadScopeDetail({ run, cwd: '/w/a', comparison: 'main' });
|
|
203
|
+
assert.deepEqual(detail, { comparison: 'main', ahead: 2, behind: 1, lastCommitSubject: 'add the scope step' });
|
|
204
|
+
assert.deepEqual(calls.map((call) => call.args), [
|
|
205
|
+
['rev-list', '--left-right', '--count', 'main...HEAD'],
|
|
206
|
+
['log', '-1', '--format=%s'],
|
|
207
|
+
]);
|
|
208
|
+
assert.deepEqual(calls.map((call) => call.options), [{ cwd: '/w/a' }, { cwd: '/w/a' }]);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('a failed read leaves its fields absent instead of throwing', async () => {
|
|
212
|
+
const allFail = await loadScopeDetail({
|
|
213
|
+
run: async () => ({ status: 1, stdout: '9\t9', stderr: 'bad revision' }),
|
|
214
|
+
cwd: '/w/a',
|
|
215
|
+
comparison: 'origin/main',
|
|
216
|
+
});
|
|
217
|
+
assert.deepEqual(allFail, { comparison: 'origin/main' });
|
|
218
|
+
|
|
219
|
+
const throwing = await loadScopeDetail({
|
|
220
|
+
run: async () => { throw new Error('spawn failed'); },
|
|
221
|
+
cwd: '/w/a',
|
|
222
|
+
comparison: 'main',
|
|
223
|
+
});
|
|
224
|
+
assert.deepEqual(throwing, { comparison: 'main' });
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test('a truncated, timed-out or malformed answer is unparsable', async () => {
|
|
228
|
+
const base = {
|
|
229
|
+
log: { status: 0, stdout: '', stderr: '' },
|
|
230
|
+
};
|
|
231
|
+
for (const range of [
|
|
232
|
+
{ status: 0, stdout: '1\t2\n', truncated: true },
|
|
233
|
+
{ status: 0, stdout: '1\t2\n', timedOut: true },
|
|
234
|
+
{ status: 0, stdout: 'not counts' },
|
|
235
|
+
{ status: 0 },
|
|
236
|
+
{ status: null, stdout: '1\t2' },
|
|
237
|
+
null,
|
|
238
|
+
]) {
|
|
239
|
+
const { run } = runner({ ...base, 'rev-list': range });
|
|
240
|
+
const detail = await loadScopeDetail({ run, cwd: '/w/a', comparison: 'main' });
|
|
241
|
+
assert.equal(detail.ahead, undefined);
|
|
242
|
+
assert.equal(detail.behind, undefined);
|
|
243
|
+
assert.deepEqual(detail, { comparison: 'main' });
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test('no comparison ref means no rev-list read, and no distance', async () => {
|
|
248
|
+
const { run, calls } = runner({ log: { status: 0, stdout: 'subject\n' } });
|
|
249
|
+
const detail = await loadScopeDetail({ run, cwd: '/w/a', comparison: '' });
|
|
250
|
+
assert.deepEqual(detail, { lastCommitSubject: 'subject' });
|
|
251
|
+
assert.deepEqual(calls.map((call) => call.args[0]), ['log']);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test('a missing runner and a missing stdout degrade instead of throwing', async () => {
|
|
255
|
+
assert.deepEqual(await loadScopeDetail({ comparison: 'main' }), { comparison: 'main' });
|
|
256
|
+
assert.deepEqual(await loadScopeDetail(), {});
|
|
257
|
+
const { run } = runner({ log: { status: 0 }, 'rev-list': { status: 0, stdout: '0 0' } });
|
|
258
|
+
assert.deepEqual(await loadScopeDetail({ run, cwd: '/w/a', comparison: 'main' }), {
|
|
259
|
+
comparison: 'main',
|
|
260
|
+
ahead: 0,
|
|
261
|
+
behind: 0,
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
});
|