repown 0.3.0 → 0.4.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/CHANGELOG.md +38 -1
- package/README.md +7 -2
- package/dist/commands/reauthor.js +64 -0
- package/dist/commands/setup.js +4 -1
- package/dist/commands/status.js +51 -11
- package/dist/commands/use.js +3 -3
- package/dist/core/blockers.js +132 -0
- package/dist/core/git.js +136 -8
- package/dist/core/guard/check.js +4 -0
- package/dist/core/push-destination.js +82 -0
- package/dist/core/push-state.js +109 -0
- package/dist/core/reauthor.js +145 -0
- package/dist/core/unpushed.js +110 -42
- package/dist/program.js +1 -0
- package/dist/ui/format.js +8 -0
- package/dist/wizard/engine.js +6 -3
- package/dist/wizard/review-text.js +17 -10
- package/dist/wizard/setup-changes.js +9 -5
- package/dist/wizard/setup-context.js +12 -5
- package/dist/wizard/setup-flow.js +155 -24
- package/dist/wizard/setup-run.js +86 -21
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,42 @@ commands. How a release is cut: [docs/RELEASING.md](docs/RELEASING.md).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-09-30
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `repown reauthor [--yes]`: gives this branch's unpushed commits by another address
|
|
15
|
+
the pinned identity. It fetches the push destination first, rewrites only commits
|
|
16
|
+
no remote has (from the oldest one by another address), refuses on a merge in that
|
|
17
|
+
range, uncommitted changes, identity overrides or a destination it can't fetch,
|
|
18
|
+
runs without hooks, keeps a backup ref, prints the undo, and never pushes (ADR-026).
|
|
19
|
+
- `repown setup --repoint` and `--fetch`, which Recommended answers Yes where they
|
|
20
|
+
apply. Repoint: where the branch pushes to a URL naming the same repository as a
|
|
21
|
+
remote, setup points it back at that remote (`git config --local <key> <remote>`);
|
|
22
|
+
the URL, which can carry a token, is never printed. Fetch: where commits by another
|
|
23
|
+
address wait behind a remote never fetched, setup fetches it first (prompts off),
|
|
24
|
+
so the count and the rebase advice are right; a failed fetch is a warning (ADR-026).
|
|
25
|
+
- `repown setup --reauthor`: where unpushed commits carry another address, setup
|
|
26
|
+
asks (default No, in Recommended too) whether to re-author them as the account,
|
|
27
|
+
and runs `repown reauthor --yes` as its last step. Like `fix`, Enter at the review
|
|
28
|
+
is Decline and at the step is Skip. An already set-up clone offers **Re-author
|
|
29
|
+
them** on its first screen (ADR-026).
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- `repown use` and setup's review no longer advise `git rebase --root` for commits a
|
|
34
|
+
never-fetched remote may already have. Where the branch's push destination has no
|
|
35
|
+
remote-tracking refs, pushes elsewhere than it fetches from, or is a URL or a name with no
|
|
36
|
+
remote, they say so, say how to fetch and count again where there is a remote to fetch,
|
|
37
|
+
and offer the rebase only for when the destination has none of those commits. The URL
|
|
38
|
+
is never printed (ADR-025).
|
|
39
|
+
- `repown setup` no longer says `done` when the next push would fail. It names what is in the way, first among the review's notes, on the already-set-up screen, and in its closing line (`set up for <account>; the next push will fail: …`): commits the guard will refuse, a sign-in in the push URL, identity or token variables, `author.email` in config, a destination owner, a diverged branch, a missing upstream, a detached HEAD (ADR-026).
|
|
40
|
+
- With the guard off, setup and status still name commits by another address, a destination owner and `GH_TOKEN`, but as a warning (`the guard is off, so …`): they no longer stop `done` or `ready` (ADR-026).
|
|
41
|
+
- `repown status` no longer says `ready` when the next push would fail. It prints what is in the way first among its warnings (`WARN push`), and ends `the next push will fail: …`; the exit code is unchanged (ADR-026).
|
|
42
|
+
- The re-author advice says `or pin that address` only when one address made them all.
|
|
43
|
+
- The suggested `git rebase` starts at the parent of the oldest commit by another address,
|
|
44
|
+
not the oldest unpushed one, so your own commits before it are never rewritten.
|
|
45
|
+
|
|
10
46
|
## [0.3.0] - 2026-09-29
|
|
11
47
|
|
|
12
48
|
### Changed
|
|
@@ -105,7 +141,8 @@ commands. How a release is cut: [docs/RELEASING.md](docs/RELEASING.md).
|
|
|
105
141
|
contract for scripts.
|
|
106
142
|
- Runs on Node 20+ on Windows, macOS and Linux, with zero runtime dependencies.
|
|
107
143
|
|
|
108
|
-
[Unreleased]: https://github.com/makubexD/repown/compare/v0.
|
|
144
|
+
[Unreleased]: https://github.com/makubexD/repown/compare/v0.4.0...HEAD
|
|
145
|
+
[0.4.0]: https://github.com/makubexD/repown/compare/v0.3.0...v0.4.0
|
|
109
146
|
[0.3.0]: https://github.com/makubexD/repown/compare/v0.2.0...v0.3.0
|
|
110
147
|
[0.2.0]: https://github.com/makubexD/repown/compare/v0.1.1...v0.2.0
|
|
111
148
|
[0.1.1]: https://github.com/makubexD/repown/compare/v0.1.0...v0.1.1
|
package/README.md
CHANGED
|
@@ -109,11 +109,14 @@ repown # in a terminal: starts the guided setup of this clone
|
|
|
109
109
|
| Question | Recommended | Step by step | Flag |
|
|
110
110
|
| --- | --- | --- | --- |
|
|
111
111
|
| Which account should this clone belong to? | Asked. `repown setup <account>` skips the mode question and uses Recommended, so a recorded account goes straight to the review when nothing else must be asked. A new account also asks where it's hosted, the name and the email. | Asked | `<account>`, `--host`, `--name`, `--email` |
|
|
112
|
+
| Push through the remote instead of a URL? Asked when the branch pushes to a URL (which can carry its own sign-in) that names the same repository as a remote here. The review shows the key and the remote, never the URL. | Answers Yes without asking | Asked, default Yes | `--repoint` |
|
|
113
|
+
| Fetch the remote first? Asked when commits by another address wait behind a remote this clone has never fetched, so repown can count which it already has. Prompts are off; a failed fetch is a warning. | Answers Yes without asking | Asked, default Yes | `--fetch` |
|
|
112
114
|
| Let this clone push to origin's owner? Asked when origin belongs to someone else, like an organisation. | Asked, default Yes. No means the guard refuses pushes there. | Asked, default Yes | `--allow-owner <owner>` |
|
|
113
115
|
| Turn the guard on? | Answers Yes without asking | Asked | `--guard` |
|
|
114
116
|
| Push branches without -u? Only on git 2.37+. It sets `push.autoSetupRemote` in this clone only; the guard still checks that first push. | Answers Yes without asking | Asked, default Yes | `--auto-upstream` |
|
|
115
117
|
| gh. "Switch gh too" makes `gh pr create` match. | Switches without asking when gh already lists the account and the clone is not already pinned to it. A sign-in, which opens a browser, is asked, default No. Skips the question when the clone is already pinned to that account. | Asked | `--gh` |
|
|
116
118
|
| Take git's sign-ins back from gh? Machine-wide. | Asked, default No. Answer Yes if `repown doctor` said gh is the helper, or pushes from your other account's clones fail. | Asked, default No | `--fix` |
|
|
119
|
+
| Re-author your unpushed commits by another address as this account? Asked when commits you made before pinning (or an IDE made) carry another email. Only if you made them. It runs last, as `repown reauthor --yes`: it fetches first, rewrites only what no remote has, keeps a backup, and never pushes. | Asked, default No. Enter at the review is Decline when this is a step. | Asked, default No; Enter at the step is Skip | `--reauthor` |
|
|
117
120
|
|
|
118
121
|
Step by step asks every question: `--step-by-step`.
|
|
119
122
|
`--no-input` asks nothing ([scripts and CI](docs/CONFIGURATION.md#scripts-and-ci)).
|
|
@@ -196,7 +199,8 @@ with no account and no flags, and setup opens on this screen, before any questio
|
|
|
196
199
|
**Done** changes nothing. **Use another account** asks which account this clone should
|
|
197
200
|
use. When gh acts as someone else, a third option is **Sign in to gh as `<account>`** (or
|
|
198
201
|
**Make `<account>` gh's active account** when gh already lists it) and runs
|
|
199
|
-
`repown use <account> --gh`.
|
|
202
|
+
`repown use <account> --gh`. With unpushed commits by another address, **Re-author them**
|
|
203
|
+
is offered too (`repown reauthor --yes`). The upstream line shows the tracked branch (for example
|
|
200
204
|
`origin/main`) when there is one, otherwise `set on the first push (push.autoSetupRemote)`
|
|
201
205
|
when that setting is on, otherwise nothing. It is the same value `repown status` shows,
|
|
202
206
|
and `repown status` shows all of this without asking. Every screen:
|
|
@@ -213,8 +217,9 @@ then commit and push.
|
|
|
213
217
|
| | `repown fix [--dry-run] [--yes]` | undo `gh auth setup-git`, so each clone's pinned account is used; shows what it removes, and the undo, first |
|
|
214
218
|
| Once per clone | `repown setup [<account>]` | guided setup of this clone. Questions, flags and the review: [Quick start](#quick-start). A clone that is already set up opens on that screen |
|
|
215
219
|
| | `repown use <account> [--gh]` | what setup runs: pin this clone to an account. `--gh` switches gh's active account, or signs the account in to gh when needed (in a terminal). `--name` with `--email` skips the registry, the file where repown remembers accounts |
|
|
220
|
+
| | `repown reauthor [--yes]` | give this branch's unpushed commits by another address your pinned identity, so the guard lets them through. Fetches the push destination first, rewrites only what no remote has, keeps a backup ref, never pushes |
|
|
216
221
|
| | `repown guard on \| off \| status` | install, remove or show the pre-push hook (bare `repown guard` shows it) |
|
|
217
|
-
| Any time | `repown status` | this clone's and this machine's settings, and what to fix. Exits 1 on a problem; warnings alone exit 0 |
|
|
222
|
+
| Any time | `repown status` | this clone's and this machine's settings, and what to fix. It ends `ready: …`, or `the next push will fail: …` with what is in the way. Exits 1 on a problem; warnings alone exit 0 |
|
|
218
223
|
| | `repown scan [dir...] [--emails] [--depth <n>] [--format json]` | every clone under the folders (default: this one, 3 levels deep): owner, host, identity, guard, and which email domains its history has. Changes nothing |
|
|
219
224
|
| Rarely | `repown accounts list \| add \| remove` | the accounts this machine knows (bare `repown accounts` lists them; `add` takes `--name`, `--email`, `--host github\|azdo\|generic`; `list --format json` for scripts) |
|
|
220
225
|
| | `repown off` | unpin this clone, leaving global config alone; warns if the guard is still on |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// `repown reauthor`: give this branch's unpushed commits by another address the pinned
|
|
2
|
+
// identity, so the guard lets them through. It fetches the push destination first, rewrites
|
|
3
|
+
// only commits no remote has, keeps a backup ref, and never pushes (ADR-026).
|
|
4
|
+
import { planReauthor, applyReauthor } from "../core/reauthor.js";
|
|
5
|
+
import { confirm, interactive } from "../ui/prompt.js";
|
|
6
|
+
import { flagBool, gitFor } from "../ui/args.js";
|
|
7
|
+
import * as out from "../ui/format.js";
|
|
8
|
+
import { printable } from "../ui/format.js";
|
|
9
|
+
export default {
|
|
10
|
+
summary: 'rewrite this branch\'s unpushed commits by another address as the pinned account',
|
|
11
|
+
options: [
|
|
12
|
+
{ name: 'yes', kind: 'boolean', help: 'rewrite without asking to confirm' },
|
|
13
|
+
],
|
|
14
|
+
examples: ['repown reauthor', 'repown reauthor --yes'],
|
|
15
|
+
async run(args) {
|
|
16
|
+
const git = gitFor(args);
|
|
17
|
+
const email = await git.getConfig('user.email', 'local') ?? '';
|
|
18
|
+
out.detail('fetching the push destination first, so only what it lacks is rewritten');
|
|
19
|
+
const planned = await planReauthor(git, email, interactive());
|
|
20
|
+
if (!planned.ok) {
|
|
21
|
+
out.fail('reauthor', printable(planned.error));
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
if (!planned.value) {
|
|
25
|
+
out.pass('reauthor', 'nothing to re-author: every unpushed commit here is by ' + printable(email));
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
preview(planned.value, email);
|
|
29
|
+
if (!await confirmed(args))
|
|
30
|
+
return 1;
|
|
31
|
+
return apply(git, planned.value, email);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
function preview(plan, email) {
|
|
35
|
+
const noun = plan.count === 1 ? '1 commit' : plan.count + ' commits';
|
|
36
|
+
out.detail(noun + ' on ' + printable(plan.branch) + ' that ' + printable(plan.remote) + ' does not have will carry ' + printable(email) +
|
|
37
|
+
' (now by ' + plan.addresses.map(printable).join(', ') + ')');
|
|
38
|
+
out.detail('from ' + (plan.base === '--root' ? 'the first commit' : plan.base.slice(0, 12)) + ' on; their author dates are reset, and a backup is kept');
|
|
39
|
+
}
|
|
40
|
+
async function confirmed(args) {
|
|
41
|
+
if (flagBool(args, 'yes'))
|
|
42
|
+
return true;
|
|
43
|
+
if (!interactive()) {
|
|
44
|
+
out.fail('reauthor', 'this rewrites commits, so it needs confirmation.');
|
|
45
|
+
out.detail('re-run with --yes to proceed without being asked.');
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (await confirm('Rewrite these commits?'))
|
|
49
|
+
return true;
|
|
50
|
+
out.warn('reauthor', 'declined; nothing was changed.');
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
async function apply(git, plan, email) {
|
|
54
|
+
const done = await applyReauthor(git, plan, email);
|
|
55
|
+
if (!done.ok) {
|
|
56
|
+
out.fail('reauthor', printable(done.error));
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
const noun = done.value.count === 1 ? '1 commit' : done.value.count + ' commits';
|
|
60
|
+
out.pass('reauthor', noun + ' now by ' + printable(email));
|
|
61
|
+
out.detail('undo: git reset --keep ' + printable(done.value.backup) + ' (drops commits made since)');
|
|
62
|
+
out.detail('nothing was pushed: git push when you are ready');
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// how it should work: Recommended fills in the guard, upstream and a gh switch, and
|
|
3
3
|
// still asks when origin belongs to someone else. Step by step asks each one.
|
|
4
4
|
// It shows the commands its answers stand for, and runs exactly those --
|
|
5
|
-
// `accounts add`, `use`, `guard on`, `fix` -- so anything it
|
|
5
|
+
// `accounts add`, `use`, `guard on`, `fix`, `reauthor`, and a few git lines -- so anything it
|
|
6
6
|
// does can be done, or scripted, without it (src/wizard/setup-run.ts).
|
|
7
7
|
import { providers } from "../core/hosts/index.js";
|
|
8
8
|
import { interactive } from "../ui/prompt.js";
|
|
@@ -19,6 +19,9 @@ export default {
|
|
|
19
19
|
{ name: 'guard', kind: 'boolean', help: 'turn the push guard on (guard on)' },
|
|
20
20
|
{ name: 'auto-upstream', kind: 'boolean', help: 'push branches without -u: the first push sets the upstream, in this clone only (push.autoSetupRemote)' },
|
|
21
21
|
{ name: 'fix', kind: 'boolean', help: 'stop gh being the credential helper, where it is (fix --yes)' },
|
|
22
|
+
{ name: 'repoint', kind: 'boolean', help: 'where the branch pushes to a URL naming the same repository as a remote, push through that remote instead (git config --local)' },
|
|
23
|
+
{ name: 'fetch', kind: 'boolean', help: 'fetch the push destination first, where commits by another address wait behind a remote never fetched (prompts off)' },
|
|
24
|
+
{ name: 'reauthor', kind: 'boolean', help: 'rewrite this branch\'s unpushed commits by another address as the account, last (reauthor --yes)' },
|
|
22
25
|
{ name: 'step-by-step', kind: 'boolean', help: 'ask every question instead of the recommended answers (not with --no-input)' },
|
|
23
26
|
{ name: 'no-input', kind: 'boolean', help: 'ask nothing: a question not given as a flag is No; exit 2 if the account is incomplete' },
|
|
24
27
|
],
|
package/dist/commands/status.js
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
// All three are printed, because the one that is invisible is the one that
|
|
12
12
|
// catches people out. gh's active account is a note: it never affects the push.
|
|
13
13
|
// A gh that could not be queried stays a warning, because that answer is unknown.
|
|
14
|
-
//
|
|
14
|
+
// What would stop the next push (blockers.ts, the list setup reads too) comes first among
|
|
15
|
+
// the warnings, and `ready:` is said only without it (ADR-026). It is still a warning:
|
|
16
|
+
// the exit code is unchanged (ADR-020). This reports; it changes nothing.
|
|
15
17
|
import { inspectRepo, inspectAuth, activeAccountLabel } from "../core/inspect.js";
|
|
16
18
|
import { isPinned } from "../core/identity.js";
|
|
17
19
|
import { loadRegistry } from "../core/registry.js";
|
|
@@ -20,6 +22,10 @@ import { existsSync } from 'node:fs';
|
|
|
20
22
|
import { join } from 'node:path';
|
|
21
23
|
import { gitFor } from "../ui/args.js";
|
|
22
24
|
import * as out from "../ui/format.js";
|
|
25
|
+
import { printable } from "../ui/format.js";
|
|
26
|
+
import { blockers } from "../core/blockers.js";
|
|
27
|
+
import { readPushFacts } from "../core/push-state.js";
|
|
28
|
+
import { readUnpushed } from "../core/unpushed.js";
|
|
23
29
|
export default {
|
|
24
30
|
summary: 'this clone\'s and this machine\'s settings, and what to fix (bare `repown` when output isn\'t a terminal)',
|
|
25
31
|
async run(args) {
|
|
@@ -34,10 +40,12 @@ export default {
|
|
|
34
40
|
const registry = await loadRegistry();
|
|
35
41
|
await summary(repo, auth, registry);
|
|
36
42
|
const problems = collectProblems(repo, auth);
|
|
37
|
-
const
|
|
43
|
+
const account = accountShown(repo, registry);
|
|
44
|
+
const found = problems.length === 0 ? await pushBlockers(repo, account) : [];
|
|
45
|
+
const warnings = await reportWarnings(repo, auth, registry, found);
|
|
38
46
|
const code = verdict(repo, auth, problems);
|
|
39
47
|
const ghNote = printGhNote(pinnedAccount(repo), auth);
|
|
40
|
-
closeStatus({ repo, problems, warnings,
|
|
48
|
+
closeStatus({ repo, problems, warnings, blockers: found, account, ghNote });
|
|
41
49
|
return code;
|
|
42
50
|
},
|
|
43
51
|
};
|
|
@@ -169,12 +177,39 @@ function matchesRecord(repo, entry) {
|
|
|
169
177
|
const id = repo.identity;
|
|
170
178
|
return id.name === entry.name && id.email?.toLowerCase() === entry.email.toLowerCase();
|
|
171
179
|
}
|
|
180
|
+
/** Read only when status finds no problem: otherwise the problem comes first. */
|
|
181
|
+
async function pushBlockers(repo, account) {
|
|
182
|
+
const facts = await readPushFacts(repo.git, await readUnpushed(repo.git));
|
|
183
|
+
const guarded = repo.guard !== 'off' || repo.hook?.redirected === true;
|
|
184
|
+
// The upstream field already says how to push a branch without one: not a warning here.
|
|
185
|
+
return blockers(facts, { email: repo.identity.email ?? '', account, autoUpstream: true, guarded });
|
|
186
|
+
}
|
|
187
|
+
/** First among the warnings. An owner the origin warning names is not said twice. */
|
|
188
|
+
function printBlockers(found, ownerWarned) {
|
|
189
|
+
for (const blocker of found) {
|
|
190
|
+
if (blocker.kind === 'owner' && ownerWarned)
|
|
191
|
+
continue;
|
|
192
|
+
const [first = '', ...rest] = blocker.lines;
|
|
193
|
+
out.warn('push', printable(first));
|
|
194
|
+
for (const line of rest)
|
|
195
|
+
out.detail(printable(line));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
172
198
|
function closeStatus(end) {
|
|
173
|
-
const line = end.problems.length === 0
|
|
174
|
-
? readyLine(end.repo, end.account, end.warnings, end.ghNote)
|
|
175
|
-
: tally(end.problems.length, end.warnings.length) + setupHint(end.repo);
|
|
176
199
|
out.note('');
|
|
177
|
-
out.note(
|
|
200
|
+
out.note(closingLine(end));
|
|
201
|
+
}
|
|
202
|
+
function closingLine(end) {
|
|
203
|
+
if (end.problems.length > 0)
|
|
204
|
+
return tally(end.problems.length, end.warnings.length) + setupHint(end.repo);
|
|
205
|
+
const blocking = end.blockers.filter((blocker) => blocker.blocks);
|
|
206
|
+
const [first] = blocking;
|
|
207
|
+
// What blocks nothing (the guard is off) is still a warning, and counted as one.
|
|
208
|
+
const quiet = end.blockers.filter((blocker) => !blocker.blocks).map(() => 'push');
|
|
209
|
+
if (!first)
|
|
210
|
+
return readyLine(end.repo, end.account, [...quiet, ...end.warnings], end.ghNote);
|
|
211
|
+
const more = blocking.length > 1 ? ' (and ' + (blocking.length - 1) + ' more above)' : '';
|
|
212
|
+
return 'the next push will fail: ' + printable(first.summary) + more;
|
|
178
213
|
}
|
|
179
214
|
const GH_OPTIONAL = ' · gh: optional (see the note above)';
|
|
180
215
|
function readyLine(repo, account, warnings, ghNote) {
|
|
@@ -223,10 +258,12 @@ export function identityProblems(repo) {
|
|
|
223
258
|
fix: SETUP_FIX,
|
|
224
259
|
}];
|
|
225
260
|
}
|
|
226
|
-
async function reportWarnings(repo, auth, registry) {
|
|
261
|
+
async function reportWarnings(repo, auth, registry, found) {
|
|
227
262
|
const tags = ['origin', 'account', 'guard', 'submodule', 'helper', 'gh'];
|
|
263
|
+
const foreignOwner = await originForeign(repo);
|
|
264
|
+
printBlockers(found, foreignOwner);
|
|
228
265
|
const fired = [
|
|
229
|
-
|
|
266
|
+
foreignOwner && ownerWarning(repo),
|
|
230
267
|
accountWarning(repo, registry),
|
|
231
268
|
guardWarning(repo),
|
|
232
269
|
submoduleWarning(repo),
|
|
@@ -285,9 +322,12 @@ function submoduleWarning(repo) {
|
|
|
285
322
|
* An organisation is never an account name, so a bare owner-vs-account
|
|
286
323
|
* comparison warns on every org repository -- which is most of them at work.
|
|
287
324
|
*/
|
|
288
|
-
async function
|
|
325
|
+
async function originForeign(repo) {
|
|
289
326
|
const allowed = await allowedOwners(repo.git, repo.identity.owner ?? repo.identity.account);
|
|
290
|
-
|
|
327
|
+
return !!repo.owner && allowed.length > 0 && !allowed.includes(repo.owner.toLowerCase());
|
|
328
|
+
}
|
|
329
|
+
function ownerWarning(repo) {
|
|
330
|
+
if (!repo.owner)
|
|
291
331
|
return false;
|
|
292
332
|
out.warn('origin', 'origin belongs to "' + repo.owner + '", which is not an owner this clone pushes to.');
|
|
293
333
|
out.detail('if that is an organisation you belong to:');
|
package/dist/commands/use.js
CHANGED
|
@@ -248,7 +248,7 @@ async function switchCli(account) {
|
|
|
248
248
|
}
|
|
249
249
|
/** Everything that is now true but not yet right. Warnings, never refusals. */
|
|
250
250
|
async function reportConcerns(account, repo, email) {
|
|
251
|
-
await reportUnpushed(repo, email);
|
|
251
|
+
await reportUnpushed(repo, email, account);
|
|
252
252
|
if (repo.credentialKeys.length === 0 && repo.url) {
|
|
253
253
|
out.warn('host', repo.provider.label + ' credentials are not pinned by repown.');
|
|
254
254
|
out.detail('commits are pinned and the guard still runs; only credential');
|
|
@@ -262,8 +262,8 @@ async function reportConcerns(account, repo, email) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
/** A warning only. Rewriting the commits stays the owner's call (ADR-013). */
|
|
265
|
-
async function reportUnpushed(repo, email) {
|
|
266
|
-
const [first, ...rest] = unpushedLines(await readUnpushed(repo.git), email);
|
|
265
|
+
async function reportUnpushed(repo, email, account) {
|
|
266
|
+
const [first, ...rest] = unpushedLines(await readUnpushed(repo.git), email, account);
|
|
267
267
|
if (!first)
|
|
268
268
|
return;
|
|
269
269
|
out.warn('commits', first);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// What will make the next commit, pull or push fail in this clone, from facts read once.
|
|
2
|
+
//
|
|
3
|
+
// Pure: setup's review and settled screen, its closing line and `repown status` all
|
|
4
|
+
// read the same list, so none of them can say "done" or "ready" over a push the guard
|
|
5
|
+
// (or git) is about to refuse. A fact that could not be read is a blocker of its own,
|
|
6
|
+
// never an absence (a skipped check must not look passed). What only the guard would
|
|
7
|
+
// refuse is still said with the guard off, as a warning that blocks nothing.
|
|
8
|
+
import { unpushedLines, foreignCount } from "./unpushed.js";
|
|
9
|
+
import { shellWord } from "./guard/check.js";
|
|
10
|
+
const TOKENS = ['GH_TOKEN', 'GITHUB_TOKEN'];
|
|
11
|
+
export function blockers(facts, choice) {
|
|
12
|
+
const branch = facts.unpushed.branch ?? 'HEAD';
|
|
13
|
+
return [
|
|
14
|
+
...unpushedBlocker(facts.unpushed, choice),
|
|
15
|
+
...elsewhereBlocker(facts.elsewhere, facts.destination, branch, choice),
|
|
16
|
+
...signinBlocker(facts, branch, choice.account),
|
|
17
|
+
...facts.env.map((name) => envBlocker(name, choice)),
|
|
18
|
+
...facts.configOverrides.map((key) => configBlocker(key, choice.email)),
|
|
19
|
+
...ownerBlocker(facts.destination, branch, choice),
|
|
20
|
+
...divergenceBlocker(facts.divergence, branch),
|
|
21
|
+
...upstreamBlocker(facts, branch, choice.autoUpstream),
|
|
22
|
+
...(facts.detached ? [detachedBlocker()] : []),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
/** What the guard does with them: refuses, or, while it is off, lets them through. */
|
|
26
|
+
function guardWord(guarded, many) {
|
|
27
|
+
if (guarded)
|
|
28
|
+
return 'the guard will refuse ' + (many ? 'them' : 'it');
|
|
29
|
+
return 'the guard is off, so ' + (many ? 'they push as they are' : 'it pushes as it is');
|
|
30
|
+
}
|
|
31
|
+
function unpushedBlocker(fact, choice) {
|
|
32
|
+
const lines = unpushedLines(fact, choice.email, choice.account, choice.guarded);
|
|
33
|
+
if (lines.length === 0)
|
|
34
|
+
return [];
|
|
35
|
+
if (!fact.commits.ok)
|
|
36
|
+
return [{ kind: 'unpushed', summary: 'unpushed commits could not be read', lines, blocks: choice.guarded }];
|
|
37
|
+
const count = foreignCount(fact, choice.email);
|
|
38
|
+
return [{ kind: 'unpushed', summary: count + (count === 1 ? ' commit' : ' commits') + ' by another address', lines, blocks: choice.guarded }];
|
|
39
|
+
}
|
|
40
|
+
/** Where a remote names the same repository, the fix is setup's repoint. */
|
|
41
|
+
function signinBlocker(facts, branch, account) {
|
|
42
|
+
const key = facts.signinKey;
|
|
43
|
+
if (!key)
|
|
44
|
+
return [];
|
|
45
|
+
const fix = facts.repoint?.key === key ? ': point it back at ' + facts.repoint.remote + ' with repown setup --repoint' : '';
|
|
46
|
+
return [{
|
|
47
|
+
kind: 'signin',
|
|
48
|
+
summary: 'the branch pushes with its own sign-in',
|
|
49
|
+
lines: [key + ' carries its own sign-in, so pushes from ' + branch + ' use it, not ' + account + fix],
|
|
50
|
+
blocks: true,
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
/** Counted with the guard's own exclusion, so a fork's upstream commits are not missed. */
|
|
54
|
+
function elsewhereBlocker(elsewhere, destination, branch, choice) {
|
|
55
|
+
if (!elsewhere.ok) {
|
|
56
|
+
return [{ kind: 'elsewhere', summary: 'commits on other remotes could not be read', lines: ['commits on other remotes could not be read (' + elsewhere.error + ')'], blocks: choice.guarded }];
|
|
57
|
+
}
|
|
58
|
+
const count = foreignCount({ branch, commits: elsewhere, unknown: null }, choice.email);
|
|
59
|
+
if (count === 0)
|
|
60
|
+
return [];
|
|
61
|
+
const where = destination?.remote ?? 'the destination';
|
|
62
|
+
const noun = count === 1 ? '1 commit' : count + ' commits';
|
|
63
|
+
return [{
|
|
64
|
+
kind: 'elsewhere',
|
|
65
|
+
summary: noun + ' from another remote',
|
|
66
|
+
lines: [noun + ' on ' + branch + ' by another address ' + (count === 1 ? 'is' : 'are') + ' on another remote but not on ' + where +
|
|
67
|
+
': ' + guardWord(choice.guarded, count > 1) + ' (a fork mirroring upstream? see repown.mirrorBranch)'],
|
|
68
|
+
blocks: choice.guarded,
|
|
69
|
+
}];
|
|
70
|
+
}
|
|
71
|
+
function configBlocker(key, email) {
|
|
72
|
+
return {
|
|
73
|
+
kind: 'config',
|
|
74
|
+
summary: key + ' is set',
|
|
75
|
+
lines: [key + " is set in git config: commits made here won't use " + email + ' (unset it: git config --unset ' + key + ')'],
|
|
76
|
+
blocks: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** An identity variable still changes every commit; a token only matters to the guard. */
|
|
80
|
+
function envBlocker(name, choice) {
|
|
81
|
+
const token = TOKENS.includes(name);
|
|
82
|
+
const identity = token ? '' : ": commits made here won't use " + choice.email;
|
|
83
|
+
const guard = choice.guarded ? 'the guard refuses every push while it is set'
|
|
84
|
+
: token ? 'the guard is off, so it stops nothing now, but with the guard on every push is refused' : '';
|
|
85
|
+
const joiner = !guard ? '' : identity ? ', and ' : ': ';
|
|
86
|
+
return {
|
|
87
|
+
kind: 'env',
|
|
88
|
+
summary: name + ' is set',
|
|
89
|
+
lines: [name + ' is set in this shell' + identity + joiner + guard + ' (unset it)'],
|
|
90
|
+
blocks: choice.guarded || !token,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function ownerBlocker(destination, branch, choice) {
|
|
94
|
+
if (!destination)
|
|
95
|
+
return [];
|
|
96
|
+
const owner = destination.owner.toLowerCase();
|
|
97
|
+
if (owner === choice.account.toLowerCase() || destination.allowed.includes(owner))
|
|
98
|
+
return [];
|
|
99
|
+
const where = destination.remote ?? 'its URL';
|
|
100
|
+
const guard = choice.guarded ? 'the guard will refuse it' : 'the guard is off, so it pushes there anyway';
|
|
101
|
+
return [{
|
|
102
|
+
kind: 'owner',
|
|
103
|
+
summary: 'the push goes to "' + destination.owner + '"',
|
|
104
|
+
lines: [branch + ' pushes to ' + where + ', owned by "' + destination.owner + '", not ' + choice.account +
|
|
105
|
+
': ' + guard + '. If you belong there: git config --local --add repown.allowOwner ' + shellWord(destination.owner)],
|
|
106
|
+
blocks: choice.guarded,
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
function divergenceBlocker(divergence, branch) {
|
|
110
|
+
if (!divergence.ok) {
|
|
111
|
+
return [{ kind: 'divergence', summary: branch + ' could not be compared with its upstream', lines: [branch + ' could not be compared with its upstream (' + divergence.error + ')'], blocks: true }];
|
|
112
|
+
}
|
|
113
|
+
const found = divergence.value;
|
|
114
|
+
if (!found || found.behind === 0 || found.ahead === 0)
|
|
115
|
+
return [];
|
|
116
|
+
return [{
|
|
117
|
+
kind: 'divergence',
|
|
118
|
+
summary: branch + ' has diverged from ' + found.tracked,
|
|
119
|
+
lines: [branch + ' is ' + found.behind + ' behind and ' + found.ahead + ' ahead of ' + found.tracked +
|
|
120
|
+
': push and pull fail until you git pull --rebase'],
|
|
121
|
+
blocks: true,
|
|
122
|
+
}];
|
|
123
|
+
}
|
|
124
|
+
function upstreamBlocker(facts, branch, autoUpstream) {
|
|
125
|
+
if (facts.upstream !== 'missing' || autoUpstream)
|
|
126
|
+
return [];
|
|
127
|
+
const remote = shellWord(facts.destination?.remote ?? 'origin');
|
|
128
|
+
return [{ kind: 'upstream', summary: branch + ' has no upstream', lines: [branch + ' has no upstream: the first push needs git push -u ' + remote + ' ' + shellWord(branch)], blocks: true }];
|
|
129
|
+
}
|
|
130
|
+
function detachedBlocker() {
|
|
131
|
+
return { kind: 'detached', summary: 'HEAD is detached', lines: ['HEAD is detached: git pull and a plain git push fail here; git switch to a branch first'], blocks: true };
|
|
132
|
+
}
|
package/dist/core/git.js
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
// `git config --get` EXITS 1 WHEN A KEY IS NOT SET. That is an answer, not a
|
|
14
14
|
// failure, and it is why nothing here treats a non-zero code as an error by
|
|
15
15
|
// itself. See the note in exec.ts.
|
|
16
|
+
import { existsSync } from 'node:fs';
|
|
17
|
+
import { join, resolve } from 'node:path';
|
|
18
|
+
import { tmpdir } from 'node:os';
|
|
19
|
+
import { randomUUID } from 'node:crypto';
|
|
16
20
|
import { run, succeeded, output, lines } from "./exec.js";
|
|
17
21
|
import { ok, err } from "./result.js";
|
|
18
22
|
export class Git {
|
|
@@ -66,6 +70,20 @@ export class Git {
|
|
|
66
70
|
async remotes() {
|
|
67
71
|
return lines(await this.exec(['remote']));
|
|
68
72
|
}
|
|
73
|
+
/** Remote names, in the order git lists them. A failed read is an error, not "none". */
|
|
74
|
+
async readRemotes() {
|
|
75
|
+
const listed = await this.exec(['remote']);
|
|
76
|
+
if (!succeeded(listed))
|
|
77
|
+
return err(listed.stderr.trim() || 'git remote failed');
|
|
78
|
+
return ok(lines(listed));
|
|
79
|
+
}
|
|
80
|
+
/** Whether any ref exists under `refs/remotes/<remote>/`. A failed read is an error, not "none". */
|
|
81
|
+
async hasTrackingRefs(remote) {
|
|
82
|
+
const listed = await this.exec(['for-each-ref', '--count=1', '--format=%(refname)', 'refs/remotes/' + remote + '/']);
|
|
83
|
+
if (!succeeded(listed))
|
|
84
|
+
return err(listed.stderr.trim() || 'git for-each-ref failed');
|
|
85
|
+
return ok(lines(listed).length > 0);
|
|
86
|
+
}
|
|
69
87
|
/**
|
|
70
88
|
* The directory every worktree shares -- where hooks and config actually live.
|
|
71
89
|
* In a linked worktree `.git` is a FILE, so joining '.git' to the root gives a
|
|
@@ -198,14 +216,91 @@ export class Git {
|
|
|
198
216
|
}
|
|
199
217
|
return err('tag chain longer than ' + MAX_TAG_CHAIN + ' starting at ' + sha);
|
|
200
218
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return
|
|
219
|
+
// ---- rewriting (repown reauthor only) -------------------------------------
|
|
220
|
+
/** A long or networked call: its own environment and timeout. Still only exec.ts spawns. */
|
|
221
|
+
execLong(args, env, timeoutMs) {
|
|
222
|
+
return run('git', ['--no-replace-objects', ...args], { cwd: this.cwd, env, timeoutMs });
|
|
223
|
+
}
|
|
224
|
+
/** Fetch with every prompt off: a sign-in that would ask fails instead. The reason is cleaned for display. */
|
|
225
|
+
async fetchQuietly(remote) {
|
|
226
|
+
const fetched = await this.execLong([...QUIET, 'fetch', '--quiet', '--no-recurse-submodules', remote], await this.quietEnvHere(), NETWORK_MS);
|
|
227
|
+
return succeeded(fetched) ? ok(undefined) : err(networkReason(fetched));
|
|
228
|
+
}
|
|
229
|
+
/** How many branches the remote lists (network, prompts off). */
|
|
230
|
+
async remoteHeadCount(remote) {
|
|
231
|
+
const listed = await this.execLong([...QUIET, 'ls-remote', '--heads', remote], await this.quietEnvHere(), NETWORK_MS);
|
|
232
|
+
return succeeded(listed) ? ok(lines(listed).length) : err(networkReason(listed));
|
|
233
|
+
}
|
|
234
|
+
/** Prompts off. ssh gets BatchMode only where neither the shell nor this clone names an ssh command. */
|
|
235
|
+
async quietEnvHere() {
|
|
236
|
+
return quietEnv(process.env, await this.getConfig('core.sshCommand') !== null);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* `git rebase <base> --exec <cmd>`, without moving other branches' refs, without folding
|
|
240
|
+
* commits (autosquash), and with no hook at all: hooksPath names a directory that does not
|
|
241
|
+
* exist, and `-c` reaches the --exec child too, so its `git commit` runs none either.
|
|
242
|
+
*/
|
|
243
|
+
async rebaseExec(base, exec) {
|
|
244
|
+
const noHooks = join(tmpdir(), 'repown-no-hooks-' + randomUUID());
|
|
245
|
+
const off = ['-c', 'rebase.updateRefs=false', '-c', 'rebase.autoSquash=false', '-c', 'core.hooksPath=' + noHooks];
|
|
246
|
+
const args = [...off, 'rebase', '--quiet', base, '--exec', exec];
|
|
247
|
+
const rebased = await this.execLong(args, process.env, REBASE_MS);
|
|
248
|
+
return succeeded(rebased) ? ok(undefined) : err(rebased.timedOut ? 'timed out' : networkReason(rebased));
|
|
249
|
+
}
|
|
250
|
+
async abortRebase() {
|
|
251
|
+
return succeeded(await this.exec(['rebase', '--abort']));
|
|
252
|
+
}
|
|
253
|
+
/** Creates `ref` at `sha`; refuses when it exists already, so nothing is overwritten. */
|
|
254
|
+
async createRef(ref, sha) {
|
|
255
|
+
return succeeded(await this.exec(['update-ref', ref, sha, '']));
|
|
256
|
+
}
|
|
257
|
+
/** Full hash of `rev`, or null when it does not resolve. */
|
|
258
|
+
async revParse(rev) {
|
|
259
|
+
return output(await this.exec(['rev-parse', '--verify', '--quiet', rev + '^{commit}']));
|
|
260
|
+
}
|
|
261
|
+
/** Full hash of the first parent; null for a root commit. */
|
|
262
|
+
async parentOf(sha) {
|
|
263
|
+
return output(await this.exec(['rev-parse', '--verify', '--quiet', sha + '^']));
|
|
205
264
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
265
|
+
async countIn(range) {
|
|
266
|
+
const counted = await this.exec(['rev-list', '--count', ...range]);
|
|
267
|
+
const count = Number(counted.stdout.trim());
|
|
268
|
+
return succeeded(counted) && Number.isInteger(count) ? ok(count) : err(counted.stderr.trim() || 'git rev-list failed');
|
|
269
|
+
}
|
|
270
|
+
/** Tracked changes, or entries hidden with skip-worktree / assume-unchanged, that a rebase could clobber. */
|
|
271
|
+
async hasTrackedChanges() {
|
|
272
|
+
const [status, files] = await Promise.all([
|
|
273
|
+
this.exec(['status', '--porcelain', '--untracked-files=no']), this.exec(['ls-files', '-v']),
|
|
274
|
+
]);
|
|
275
|
+
if (!succeeded(status) || !succeeded(files))
|
|
276
|
+
return err('git status failed');
|
|
277
|
+
const hidden = lines(files).some((line) => /^([a-z]|S) /.test(line));
|
|
278
|
+
return ok(status.stdout.trim().length > 0 || hidden);
|
|
279
|
+
}
|
|
280
|
+
/** The operation a half-finished rebase, merge, cherry-pick, revert or bisect left, or null. */
|
|
281
|
+
async operationInProgress() {
|
|
282
|
+
for (const [path, name] of IN_PROGRESS) {
|
|
283
|
+
const where = output(await this.exec(['rev-parse', '--git-path', path]));
|
|
284
|
+
if (where && existsSync(resolve(this.cwd, where)))
|
|
285
|
+
return name;
|
|
286
|
+
}
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
/** `git rev-list --left-right --count A...B`: commits only on the left, and only on the right. */
|
|
290
|
+
async leftRightCount(range) {
|
|
291
|
+
const counted = await this.exec(['rev-list', '--left-right', '--count', range]);
|
|
292
|
+
const [left, right] = (succeeded(counted) ? counted.stdout.trim() : '').split(/\s+/).map(Number);
|
|
293
|
+
if (!succeeded(counted) || !Number.isInteger(left) || !Number.isInteger(right)) {
|
|
294
|
+
return err(counted.stderr.trim() || 'git rev-list could not count ' + range);
|
|
295
|
+
}
|
|
296
|
+
return ok({ left: left, right: right });
|
|
297
|
+
}
|
|
298
|
+
/** Each commit in `range` (full hash) and its first parent's short hash, null for a root. */
|
|
299
|
+
async firstParentsIn(range) {
|
|
300
|
+
const listed = await this.exec(['log', '--no-show-signature', '--format=%H %p', ...range]);
|
|
301
|
+
if (!succeeded(listed))
|
|
302
|
+
return err(listed.stderr.trim() || 'git log failed');
|
|
303
|
+
return ok(new Map(lines(listed).map(parentPair)));
|
|
209
304
|
}
|
|
210
305
|
/** Whether this clone has the commit at all -- a remote tip it never fetched is absent. */
|
|
211
306
|
async hasCommit(sha) {
|
|
@@ -220,7 +315,9 @@ export class Git {
|
|
|
220
315
|
* clone. Excluding the mirror branch leaves the commits written HERE.
|
|
221
316
|
*/
|
|
222
317
|
async emailCounts(exclude) {
|
|
223
|
-
|
|
318
|
+
// repown reauthor's backups keep the old commits alive; they are not this clone's history.
|
|
319
|
+
const all = ['--exclude=refs/repown/*', '--all'];
|
|
320
|
+
const range = exclude ? [...all, '--not', exclude] : all;
|
|
224
321
|
// --no-show-signature: a scanned repository's own log.showSignature + gpg.program
|
|
225
322
|
// would otherwise run a program of its choosing.
|
|
226
323
|
const result = await this.exec(['log', '--no-show-signature', ...range, '--format=%ae%n%ce']);
|
|
@@ -250,6 +347,37 @@ function parseOriginLine(line) {
|
|
|
250
347
|
* so nothing an author writes can shift them; the subject cannot reach past its
|
|
251
348
|
* own terminator either. Records are a fixed IDENTITY_FIELDS long.
|
|
252
349
|
*/
|
|
350
|
+
const NETWORK_MS = 120_000;
|
|
351
|
+
const REBASE_MS = 600_000;
|
|
352
|
+
/** Empty askPass: git asks no helper for a password (GIT_TERMINAL_PROMPT covers the terminal). */
|
|
353
|
+
const QUIET = ['-c', 'core.askPass=', '-c', 'credential.interactive=false'];
|
|
354
|
+
const IN_PROGRESS = [
|
|
355
|
+
['rebase-merge', 'rebase'], ['rebase-apply', 'rebase'], ['MERGE_HEAD', 'merge'],
|
|
356
|
+
['CHERRY_PICK_HEAD', 'cherry-pick'], ['REVERT_HEAD', 'revert'], ['BISECT_LOG', 'bisect'],
|
|
357
|
+
];
|
|
358
|
+
/**
|
|
359
|
+
* The whole environment, with every way git could prompt turned off. ssh is made
|
|
360
|
+
* non-interactive only where nothing names an ssh command already: GIT_SSH_COMMAND outranks
|
|
361
|
+
* core.sshCommand and GIT_SSH, so setting it would replace a per-account key (`ssh -i ...`).
|
|
362
|
+
*/
|
|
363
|
+
export function quietEnv(env, sshConfigured) {
|
|
364
|
+
const { GIT_ASKPASS: _git, SSH_ASKPASS: _ssh, ...rest } = env;
|
|
365
|
+
const ownSsh = sshConfigured || !!env['GIT_SSH_COMMAND'] || !!env['GIT_SSH'];
|
|
366
|
+
const batch = ownSsh ? {} : { GIT_SSH_COMMAND: 'ssh -o BatchMode=yes' };
|
|
367
|
+
return { ...rest, GIT_TERMINAL_PROMPT: '0', GCM_INTERACTIVE: 'never', ...batch };
|
|
368
|
+
}
|
|
369
|
+
/** git's last error line, with a URL's credentials and query masked and control characters removed. */
|
|
370
|
+
export function networkReason(result) {
|
|
371
|
+
if (result.timedOut)
|
|
372
|
+
return 'timed out';
|
|
373
|
+
const last = result.stderr.trim().split('\n').filter(Boolean).at(-1) ?? 'git failed';
|
|
374
|
+
return last.replace(/(\w+:\/\/)\S*@/g, '$1***@').replace(/(\w+:\/\/[^\s?]*)\?[^\s'"]*/g, '$1?***').replace(/[\x00-\x1f\x7f-\x9f]/g, '?');
|
|
375
|
+
}
|
|
376
|
+
/** `<sha> <parent> [<parent>...]`; a root has none. */
|
|
377
|
+
function parentPair(line) {
|
|
378
|
+
const [sha = '', first = ''] = line.trim().split(' ');
|
|
379
|
+
return [sha, first || null];
|
|
380
|
+
}
|
|
253
381
|
const IDENTITY_FORMAT = '%H%x00%ae%x00%ce%x00%an%x00%cn%x00%s%x00';
|
|
254
382
|
const IDENTITY_FIELDS = 6;
|
|
255
383
|
const MAX_TAG_CHAIN = 16;
|
package/dist/core/guard/check.js
CHANGED
|
@@ -58,6 +58,10 @@ export async function check(input) {
|
|
|
58
58
|
const destination = checkDestination({ url, owner, allowed }, input.onNote);
|
|
59
59
|
return [...destination, ...await checkCommits(input, identity.email)];
|
|
60
60
|
}
|
|
61
|
+
/** The names of the variables above that are set (non-empty) in `env`, in that order. */
|
|
62
|
+
export function hostileSet(env) {
|
|
63
|
+
return HOSTILE.filter(([name]) => !!env[name]).map(([name]) => name);
|
|
64
|
+
}
|
|
61
65
|
function checkEnvironment() {
|
|
62
66
|
return HOSTILE.flatMap(([name, why]) => {
|
|
63
67
|
if (!process.env[name])
|