repown 0.7.0 → 0.8.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 +53 -4
- package/README.md +54 -36
- package/dist/commands/doctor.js +37 -4
- package/dist/commands/use.js +1 -1
- package/dist/core/credential/gcm.js +2 -2
- package/dist/core/guard/check.js +3 -1
- package/dist/core/machine-default.js +67 -0
- package/dist/core/signin-check.js +16 -1
- package/dist/core/signin-repair.js +4 -3
- package/dist/wizard/home-context.js +9 -6
- package/dist/wizard/home-flow.js +31 -8
- package/dist/wizard/home-text.js +15 -2
- package/dist/wizard/setup-run.js +14 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,45 @@ commands. How a release is cut: [docs/RELEASING.md](docs/RELEASING.md).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.0] - 2026-11-29
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `repown doctor` shows the machine default: who a clone repown hasn't pinned commits as
|
|
14
|
+
(your global `user.name` and `user.email`, the file the email comes from, and which
|
|
15
|
+
recorded account it belongs to), what git does when no address is set (refuses, with
|
|
16
|
+
`user.useConfigOnly`, or makes one up), and any `includeIf` folder rules. A variable the guard refuses (`GH_TOKEN`, `GITHUB_TOKEN`,
|
|
17
|
+
`GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_EMAIL`) set in your shell is a warning. Nothing is
|
|
18
|
+
changed: how to make such a clone refuse to commit is printed, never run.
|
|
19
|
+
- The start screen (bare `repown` outside a clone) shows the same default in a `Default`
|
|
20
|
+
row, a `Shell` row when such a variable is set, and counts the clones not set up that one
|
|
21
|
+
of your recorded accounts owns.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- The start screen looks for clones 3 levels down, as `repown scan` does, instead of 2.
|
|
25
|
+
|
|
26
|
+
## [0.7.1] - 2026-11-29
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- `docs/TROUBLESHOOTING.md` lists every message repown and git print, with its fix.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- The guard's refusal of commits by another address now ends with the fix:
|
|
33
|
+
`repown reauthor`, which rewrites that branch's unpushed commits as the pinned account,
|
|
34
|
+
asks first, and never pushes.
|
|
35
|
+
- `repown use`, when no credential is stored yet, points at `repown doctor --online` to
|
|
36
|
+
check the sign-in (it pointed at `repown doctor`, which can't check it).
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Done on an already set-up clone offered the online sign-in check even when something
|
|
40
|
+
would stop the next push. It now says `sign-in not checked online: the next push will
|
|
41
|
+
fail: …` instead, as after a run.
|
|
42
|
+
- Where the push URL names a user other than the pinned account, a rejected or missing
|
|
43
|
+
sign-in suggested a Git Credential Manager sign-in as that user. It now says the URL
|
|
44
|
+
names that user, and to remove it.
|
|
45
|
+
- With no credential helper at all, `repown doctor` said it couldn't tell whether
|
|
46
|
+
"nothing" honours the per-clone pin. It now says no helper serves github.com, and how to
|
|
47
|
+
set up Git Credential Manager.
|
|
48
|
+
|
|
10
49
|
## [0.7.0] - 2026-11-28
|
|
11
50
|
|
|
12
51
|
### Added
|
|
@@ -278,9 +317,17 @@ and cmd. `status`, `doctor` and the pre-push guard are faster on Windows.
|
|
|
278
317
|
remote, they say so, say how to fetch and count again where there is a remote to fetch,
|
|
279
318
|
and offer the rebase only for when the destination has none of those commits. The URL
|
|
280
319
|
is never printed (ADR-025).
|
|
281
|
-
- `repown setup` no longer says `done` when the next push would fail. It names what is in
|
|
282
|
-
|
|
283
|
-
|
|
320
|
+
- `repown setup` no longer says `done` when the next push would fail. It names what is in
|
|
321
|
+
the way, first among the review's notes, on the already-set-up screen, and in its closing
|
|
322
|
+
line (`set up for <account>; the next push will fail: …`): commits the guard will refuse,
|
|
323
|
+
a sign-in in the push URL, identity or token variables, `author.email` in config, a
|
|
324
|
+
destination owner, a diverged branch, a missing upstream, a detached HEAD (ADR-026).
|
|
325
|
+
- With the guard off, setup and status still name commits by another address, a
|
|
326
|
+
destination owner and `GH_TOKEN`, but as a warning (`the guard is off, so …`): they no
|
|
327
|
+
longer stop `done` or `ready` (ADR-026).
|
|
328
|
+
- `repown status` no longer says `ready` when the next push would fail. It prints what is
|
|
329
|
+
in the way first among its warnings (`WARN push`), and ends `the next push will fail: …`;
|
|
330
|
+
the exit code is unchanged (ADR-026).
|
|
284
331
|
- The re-author advice says `or pin that address` only when one address made them all.
|
|
285
332
|
- The suggested `git rebase` starts at the parent of the oldest commit by another address,
|
|
286
333
|
not the oldest unpushed one, so your own commits before it are never rewritten.
|
|
@@ -383,7 +430,9 @@ and cmd. `status`, `doctor` and the pre-push guard are faster on Windows.
|
|
|
383
430
|
contract for scripts.
|
|
384
431
|
- Runs on Node 20+ on Windows, macOS and Linux, with zero runtime dependencies.
|
|
385
432
|
|
|
386
|
-
[Unreleased]: https://github.com/makubexD/repown/compare/v0.
|
|
433
|
+
[Unreleased]: https://github.com/makubexD/repown/compare/v0.8.0...HEAD
|
|
434
|
+
[0.8.0]: https://github.com/makubexD/repown/compare/v0.7.1...v0.8.0
|
|
435
|
+
[0.7.1]: https://github.com/makubexD/repown/compare/v0.7.0...v0.7.1
|
|
387
436
|
[0.7.0]: https://github.com/makubexD/repown/compare/v0.6.0...v0.7.0
|
|
388
437
|
[0.6.0]: https://github.com/makubexD/repown/compare/v0.5.5...v0.6.0
|
|
389
438
|
[0.5.5]: https://github.com/makubexD/repown/compare/v0.5.4...v0.5.5
|
package/README.md
CHANGED
|
@@ -96,9 +96,21 @@ cd ~/code/my-repo
|
|
|
96
96
|
repown # in a terminal: starts the guided setup of this clone
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
> 👤 **Only one account?** repown still helps: it pins each clone, so a global identity that
|
|
100
|
+
> changes (an IDE, a CI script, a work email set machine-wide) can't leak into its commits;
|
|
101
|
+
> the guard checks every push; and `repown doctor --online` checks the sign-in. You need
|
|
102
|
+
> only `repown doctor` once and `repown` in each clone.
|
|
103
|
+
|
|
104
|
+
1. **`repown doctor`, once per machine, from any folder.** It shows who a clone repown
|
|
105
|
+
hasn't pinned commits as (your global identity, and whose account that is), then ends
|
|
106
|
+
with a verdict:
|
|
100
107
|
- 🟢 `ready: each clone signs in as its own account through Git Credential Manager`
|
|
108
|
+
- 🟢 `ready · no accounts stored yet: the first push signs in once`
|
|
101
109
|
- 🔴 `1 problem: gh answers git's sign-in requests: run repown fix`
|
|
110
|
+
- 🟡 `unchecked: repown can't tell whether <helper> honours the per-clone pin` (often
|
|
111
|
+
macOS's `osxkeychain`: install GCM, then `git credential-manager configure`)
|
|
112
|
+
- 🟡 `unchecked: no credential helper serves github.com: git credential-manager configure`
|
|
113
|
+
(often Linux: install GCM first)
|
|
102
114
|
|
|
103
115
|
If gh is the helper, or something is missing, see [Troubleshooting](#troubleshooting).
|
|
104
116
|
2. **Clone as usual,** then from inside a new clone just type **`repown`.** That starts
|
|
@@ -106,20 +118,22 @@ repown # in a terminal: starts the guided setup of this clone
|
|
|
106
118
|
in first: pick the account that owns it.) It asks how setup should work. Recommended is
|
|
107
119
|
the default. Answers it fills in still appear in the review.
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
| Let this clone push to origin's owner
|
|
115
|
-
| Turn the guard on? |
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
`--no-input` asks nothing
|
|
121
|
+
Only the questions that apply to this clone are asked:
|
|
122
|
+
|
|
123
|
+
| Question | Recommended | Flag |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| Which account should this clone belong to? (a new one also asks host, name, email) | Asked | `<account>`, `--host`, `--name`, `--email` |
|
|
126
|
+
| Let this clone push to origin's owner, such as an organisation? | Asked, default Yes | `--allow-owner <owner>` |
|
|
127
|
+
| Turn the guard on? · Push branches without `-u`? (git 2.37+) · Push through the remote instead of a URL? · Fetch the remote first? | Yes, without asking | `--guard`, `--auto-upstream`, `--repoint`, `--fetch` |
|
|
128
|
+
| Switch gh too, so `gh pr create` matches? | Yes without asking when gh lists the account and the clone isn't already pinned to it; a gh sign-in (a browser) is asked, default No | `--gh` |
|
|
129
|
+
| Take git's sign-ins back from gh? (machine-wide: answer Yes if `repown doctor` said gh is the helper) | Asked, default No | `--fix` |
|
|
130
|
+
| Re-author your unpushed commits by another address? (only if you made them; runs last, as `repown reauthor --yes`) | Asked, default No | `--reauthor` |
|
|
131
|
+
|
|
132
|
+
`repown setup <account>` skips the mode question and uses Recommended, so a recorded
|
|
133
|
+
account goes straight to the review when nothing else must be asked. Step by step asks
|
|
134
|
+
every question: `--step-by-step`. `--no-input` asks nothing
|
|
135
|
+
([scripts and CI](docs/CONFIGURATION.md#scripts-and-ci)). When each one is asked, and its
|
|
136
|
+
default: [card 13](docs/HOW-IT-WORKS.md#13-guided-setup).
|
|
123
137
|
|
|
124
138
|
- **In your first clone,** it lists the accounts it can already see on GitHub (origin's
|
|
125
139
|
owner, gh's accounts, Git Credential Manager's) and suggests origin's owner when that
|
|
@@ -166,8 +180,9 @@ repown # in a terminal: starts the guided setup of this clone
|
|
|
166
180
|
`done … · origin accepts the sign-in` only when it passes
|
|
167
181
|
([card 13](docs/HOW-IT-WORKS.md#13-guided-setup)).
|
|
168
182
|
|
|
169
|
-
4. **Push.** The first push from each account signs in once
|
|
170
|
-
sign
|
|
183
|
+
4. **Push.** The first push from each account signs in once (unless you accepted the
|
|
184
|
+
sign-in that setup's check offered): GCM opens a browser, and you sign in as *that* clone's account,
|
|
185
|
+
not whichever you used last. After that, pushes from
|
|
171
186
|
that clone use it without asking. When setup set `push.autoSetupRemote`, the first
|
|
172
187
|
`git push` of a branch without an upstream also creates it on origin. When it did not
|
|
173
188
|
(older git, a version repown could not read, or you answered No), use
|
|
@@ -204,8 +219,10 @@ with no account and no flags, and setup opens on this screen, before any questio
|
|
|
204
219
|
└
|
|
205
220
|
```
|
|
206
221
|
|
|
207
|
-
**Done** changes nothing
|
|
208
|
-
|
|
222
|
+
**Done** changes nothing, then, when nothing blocks the next push, offers the same sign-in
|
|
223
|
+
check as after a run (otherwise it says
|
|
224
|
+
`sign-in not checked online: the next push will fail: …`). **Use another account** asks
|
|
225
|
+
which account this clone should use. When gh acts as someone else, a third option is **Sign in to gh as `<account>`** (or
|
|
209
226
|
**Make `<account>` gh's active account** when gh already lists it) and runs
|
|
210
227
|
`repown use <account> --gh`. With unpushed commits by another address, **Re-author them**
|
|
211
228
|
is offered too (`repown reauthor --yes`). The upstream line shows the tracked branch (for example
|
|
@@ -241,8 +258,9 @@ then commit and push.
|
|
|
241
258
|
| stdout redirected (stdin and stderr still terminals) | Status inside a clone. The top help outside a clone, exit 0 |
|
|
242
259
|
| No terminal (stdin or stderr is not one) | Status. Exit 1 outside a clone |
|
|
243
260
|
|
|
244
|
-
The start screen lists the accounts on this machine
|
|
245
|
-
|
|
261
|
+
The start screen lists the accounts on this machine, who a clone repown hasn't pinned
|
|
262
|
+
commits as, and the clones it found up to 3 levels down (counting those your accounts own),
|
|
263
|
+
then offers the next command. The summary is in the frame. Picking a command closes the frame with
|
|
246
264
|
that command (Record an account first asks the login, host, name and email in it; Remove
|
|
247
265
|
an account asks which, then to confirm). Nothing changes until you pick one. After
|
|
248
266
|
recording or removing an account, checking the machine or stopping gh, it comes back with
|
|
@@ -290,31 +308,29 @@ note, not a warning. Every warning it can print:
|
|
|
290
308
|
| --- | --- | --- | --- | --- |
|
|
291
309
|
| In general | Success | Failure or refusal | Usage error | 130 when setup or the start screen is cancelled |
|
|
292
310
|
| `repown scan` | Whatever it finds (read its output or JSON) | | A missing folder or a bad `--depth` | |
|
|
293
|
-
| `repown setup` | Done, or already set up | Decline, or it can't start | Flags that don't fit, or no terminal without `--no-input` | 130 when cancelled or interrupted; a failing step's own code |
|
|
311
|
+
| `repown setup` | Done, or already set up. A sign-in the last step found refused is said in the closing line, not the exit code | Decline, or it can't start | Flags that don't fit, or no terminal without `--no-input` | 130 when cancelled or interrupted; a failing step's own code |
|
|
294
312
|
| `repown status` | Success. Warnings alone exit 0 | A problem | | |
|
|
295
|
-
| `repown doctor --online` | Ready, and the remote accepts the sign-in | A problem, or the remote refused the sign-in | | 3 when the sign-in
|
|
313
|
+
| `repown doctor --online` | Ready, and the remote accepts the sign-in | A problem, or the remote refused the sign-in | | 3 when the sign-in wasn't confirmed: no network, a timeout, no commit, no remote, or an answer repown can't classify (the `WARN` shows git's reason). 1 instead if the offline checks already failed |
|
|
296
314
|
|
|
297
315
|
Every `setup` case: [Scripts and CI](docs/CONFIGURATION.md#scripts-and-ci).
|
|
298
316
|
|
|
299
317
|
## Troubleshooting
|
|
300
318
|
|
|
319
|
+
Start with `repown` in the clone, `repown doctor`, then `repown doctor --online`. The most
|
|
320
|
+
common cases:
|
|
321
|
+
|
|
301
322
|
| What happened | What to do |
|
|
302
323
|
| --- | --- |
|
|
303
324
|
| `repown doctor` says gh is the helper | `repown fix` ([card 1](docs/HOW-IT-WORKS.md#1-set-up-the-machine)) |
|
|
304
|
-
| `repown doctor` shows `GCM` … `not found` | install Git Credential Manager ([Install](#install)), then `repown doctor` again |
|
|
305
|
-
| `repown doctor` shows `helper` … `none configured` | `git credential-manager configure`, then `repown doctor` again |
|
|
306
325
|
| A push asked for a password | `repown status` (this clone) or `repown doctor` (this machine): each names the cause (gh as the helper, or no helper) and the fix |
|
|
307
|
-
| A push
|
|
308
|
-
|
|
|
309
|
-
| The guard
|
|
326
|
+
| A pinned clone still can't push or pull ("Invalid username or token", "SAML SSO", 403, 404) | `repown doctor --online`: it tells a rejected or missing token, an SSO approval, the wrong account, a repository that account can't see, and an SSH key, host key or deploy key problem apart, with the command or link that fixes it. In a terminal it offers to run the fix, then checks again |
|
|
327
|
+
| The guard refused a push: commits by another address | most often made before pinning: `repown reauthor` (fetches, rewrites only what no remote has, keeps a backup, never pushes); for just the last one, `git commit --amend --reset-author --no-edit`. Every other refusal: [card 8](docs/HOW-IT-WORKS.md#8-push-refused-and-the-fix) |
|
|
328
|
+
| The guard said the push goes to another owner (on Azure DevOps, the organisation) | if you're a member or collaborator there: `git config --local --add repown.allowOwner <owner>` |
|
|
310
329
|
| `gh pr create` acts as the wrong account | `gh auth switch -u <account>` when gh lists it, otherwise `repown use <account> --gh` |
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
| husky or another tool owns the pre-push hook | have that hook run `repown guard check --remote="$1" --url="$2"`, passing its stdin through; if the hook is committed, make it skip teammates without repown ([card 10](docs/HOW-IT-WORKS.md#10-other-hook-tools)) |
|
|
316
|
-
| An Azure DevOps push is refused as "wrong owner" | the owner there is the organisation: allow it with `git config --local --add repown.allowOwner <organisation>` |
|
|
317
|
-
| "repown cannot be found" on push | [card 12](docs/HOW-IT-WORKS.md#12-uninstall-or-repown-missing) |
|
|
330
|
+
|
|
331
|
+
📖 Everything else, by the exact message you see (doctor's and status's every line, setup's
|
|
332
|
+
closing line, git's own errors, a missing `repown`, the macOS and Linux helpers):
|
|
333
|
+
[docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
|
|
318
334
|
|
|
319
335
|
A refused push:
|
|
320
336
|
|
|
@@ -323,6 +339,7 @@ FAIL guard 1 commit(s) bound for refs/heads/main were not authored as octo
|
|
|
323
339
|
6e7b31adb someone@example.invalid someone else's commit
|
|
324
340
|
|
|
325
341
|
These addresses become permanent once pushed.
|
|
342
|
+
fix: repown reauthor (on that branch: rewrites the unpushed ones as the pinned account; asks first, never pushes)
|
|
326
343
|
|
|
327
344
|
|
|
328
345
|
Push stopped by the repown identity guard (above).
|
|
@@ -356,7 +373,7 @@ $ repown use octocat
|
|
|
356
373
|
OK identity Octo Cat <octocat@users.noreply.github.com> push-as:octocat
|
|
357
374
|
|
|
358
375
|
No stored credential for "octocat" yet -- the first push signs in
|
|
359
|
-
once, then never again.
|
|
376
|
+
once, then never again. To sign in and check now: repown doctor --online
|
|
360
377
|
|
|
361
378
|
Next: repown guard on (check every push before it leaves)
|
|
362
379
|
|
|
@@ -392,6 +409,7 @@ want it back: `gh auth setup-git`. Details, and submodules:
|
|
|
392
409
|
| --- | --- |
|
|
393
410
|
| every scenario, with diagrams | [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md) |
|
|
394
411
|
| environment variables, where accounts are kept, per-clone keys, scripts and JSON | [docs/CONFIGURATION.md](docs/CONFIGURATION.md) |
|
|
412
|
+
| what a message means, and the command that fixes it | [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) |
|
|
395
413
|
| short answers, and how repown compares with `includeIf`, SSH aliases and `gh auth switch` | [docs/FAQ.md](docs/FAQ.md) |
|
|
396
414
|
| to contribute, see where each feature lives in the code, or try it on throwaway repositories | [CONTRIBUTING.md](CONTRIBUTING.md) |
|
|
397
415
|
| to report a vulnerability privately | [SECURITY.md](SECURITY.md) |
|
package/dist/commands/doctor.js
CHANGED
|
@@ -19,6 +19,7 @@ import { flagBool, gitFor } from '../ui/args.js';
|
|
|
19
19
|
import { askOnline, closingWithOnline } from './doctor-online.js';
|
|
20
20
|
import { snapshotOf } from '../core/config-snapshot.js';
|
|
21
21
|
import { parseGitUrl } from '../core/url.js';
|
|
22
|
+
import { ownerOfEmail, readMachineDefault, refuseAdvice, withoutEmail } from '../core/machine-default.js';
|
|
22
23
|
import * as out from '../ui/format.js';
|
|
23
24
|
const DOCTOR_TITLE = 'repown doctor · how this machine signs in to git hosts';
|
|
24
25
|
const NAME_WIDTH = 14;
|
|
@@ -41,7 +42,7 @@ export default {
|
|
|
41
42
|
const git = snapshotOf(gitFor(args));
|
|
42
43
|
const repo = await inspectRepo(git);
|
|
43
44
|
const auth = await inspectAuth(git, probeUrl(repo));
|
|
44
|
-
const warned = printReport(repo, auth, await loadRegistry());
|
|
45
|
+
const warned = printReport(repo, auth, await loadRegistry(), await readMachineDefault());
|
|
45
46
|
const found = diagnose(auth, ssoHost(repo));
|
|
46
47
|
if (!flagBool(args, 'online')) {
|
|
47
48
|
closeDoctor(scoped(repo, found) + warningTally(warned));
|
|
@@ -266,17 +267,41 @@ function recordedPhrase(row) {
|
|
|
266
267
|
return '';
|
|
267
268
|
}
|
|
268
269
|
/** Prints the machine and its accounts; returns how many sources could not be read. */
|
|
269
|
-
function printReport(repo, auth, registry) {
|
|
270
|
+
function printReport(repo, auth, registry, machine) {
|
|
270
271
|
out.heading(DOCTOR_TITLE);
|
|
271
272
|
const unpinned = unpinnedClone(repo);
|
|
272
273
|
if (unpinned)
|
|
273
274
|
printClone(repo);
|
|
274
275
|
printMachine(auth, unpinned ? MACHINE_FOR_GITHUB : MACHINE);
|
|
276
|
+
const shell = printDefault(machine, registry);
|
|
275
277
|
// In an unpinned clone the rows are github.com's sign-ins, none of them this clone's.
|
|
276
278
|
const report = accountRows(registry, auth, unpinned ? null : pinnedOf(repo));
|
|
277
279
|
printAccounts(report);
|
|
278
280
|
out.line();
|
|
279
|
-
return report.warnings.length;
|
|
281
|
+
return report.warnings.length + shell;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Who a clone repown hasn't pinned commits as (ADR-033): read-only, and the useConfigOnly
|
|
285
|
+
* advice is printed, never run. Returns how many warnings it printed (the shell's variables).
|
|
286
|
+
*/
|
|
287
|
+
function printDefault(machine, registry) {
|
|
288
|
+
out.heading(DEFAULT_HEADING);
|
|
289
|
+
out.field('user.name', out.printable(machine.name ?? 'none'));
|
|
290
|
+
out.field('user.email', machine.email ? out.printable(machine.email) + ' (' + emailWhere(machine.emailFile) + ')' : 'none: ' + withoutEmail(machine));
|
|
291
|
+
if (machine.email && registry.ok)
|
|
292
|
+
out.field('belongs to', out.printable(ownerOfEmail(machine.email, registry.value) ?? 'no recorded account'));
|
|
293
|
+
const advice = refuseAdvice(machine);
|
|
294
|
+
if (advice)
|
|
295
|
+
out.detail(out.printable(advice));
|
|
296
|
+
for (const [index, rule] of machine.includeIfs.entries())
|
|
297
|
+
out.field(index === 0 ? 'includeIf' : '', out.printable(rule.condition + ' -> ' + rule.path));
|
|
298
|
+
for (const name of machine.env)
|
|
299
|
+
out.warn('shell', name + ' is set: the guard refuses every push while it is');
|
|
300
|
+
return machine.env.length;
|
|
301
|
+
}
|
|
302
|
+
const DEFAULT_HEADING = "Machine default (what a clone repown hasn't pinned commits as)";
|
|
303
|
+
function emailWhere(file) {
|
|
304
|
+
return file ? out.displayPath(out.printable(file)) : 'set for every git command: -c or GIT_CONFIG_*';
|
|
280
305
|
}
|
|
281
306
|
/**
|
|
282
307
|
* Said first, since the machine below is github.com's: why origin gets no pin, and the helper
|
|
@@ -374,12 +399,20 @@ function ghHelperFiles(auth) {
|
|
|
374
399
|
out.detail(' ' + file);
|
|
375
400
|
}
|
|
376
401
|
function diagnoseUnknownHelper(auth) {
|
|
377
|
-
|
|
402
|
+
if (!auth.helper)
|
|
403
|
+
return diagnoseNoHelper();
|
|
404
|
+
const helper = out.printable(auth.helper);
|
|
378
405
|
out.warn('helper', 'github.com is served by "' + helper + '", which repown has no opinion about.');
|
|
379
406
|
out.detail('The per-repository pin (credential.<url>.username) only works if');
|
|
380
407
|
out.detail('that helper honours it.');
|
|
381
408
|
return { code: 0, verdict: unchecked(helper) };
|
|
382
409
|
}
|
|
410
|
+
/** Nothing serves github.com, so a push has nothing to sign in with: say so, and the fix. */
|
|
411
|
+
function diagnoseNoHelper() {
|
|
412
|
+
out.warn('helper', 'no credential helper serves github.com, so a push has nothing to sign in with.');
|
|
413
|
+
out.detail('Install Git Credential Manager (Git for Windows includes it), then: git credential-manager configure');
|
|
414
|
+
return { code: 0, verdict: 'unchecked: no credential helper serves github.com: git credential-manager configure' };
|
|
415
|
+
}
|
|
383
416
|
function unchecked(helper) {
|
|
384
417
|
return 'unchecked: repown can\'t tell whether ' + helper + ' honours the per-clone pin';
|
|
385
418
|
}
|
package/dist/commands/use.js
CHANGED
|
@@ -295,6 +295,6 @@ async function credentialConcern(account, repo) {
|
|
|
295
295
|
else if (auth.gcmPresent && auth.stored.ok && !auth.stored.value.includes(account)) {
|
|
296
296
|
out.line();
|
|
297
297
|
out.line(' No stored credential for "' + account + '" yet -- the first push signs in');
|
|
298
|
-
out.line(' once, then never again.
|
|
298
|
+
out.line(' once, then never again. To sign in and check now: repown doctor --online');
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -83,8 +83,8 @@ export async function listAccounts(gcmPath, namespace) {
|
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* GCM's own github.com sign-in, with the terminal handed to it (ADR-032): the browser opens,
|
|
86
|
-
* the user signs in, and GCM stores the token. repown sees nothing GCM prints.
|
|
87
|
-
* GCM 2.6.1
|
|
86
|
+
* the user signs in, and GCM stores the token. repown sees nothing GCM prints. Measured on
|
|
87
|
+
* GCM 2.6.1, over an account GCM already holds too (ADR-032).
|
|
88
88
|
* Offered only for github.com with GCM as the helper.
|
|
89
89
|
*/
|
|
90
90
|
export async function gcmGithubLogin(account, runner = inherit) {
|
package/dist/core/guard/check.js
CHANGED
|
@@ -210,6 +210,8 @@ async function rangeFor(git, ref, exclude) {
|
|
|
210
210
|
const known = !isZero(ref.remoteSha) && await git.hasCommit(ref.remoteSha);
|
|
211
211
|
return known ? [ref.remoteSha + '..' + ref.localSha, ...exclude] : [ref.localSha, ...exclude];
|
|
212
212
|
}
|
|
213
|
+
/** reauthor rewrites this branch's commits no remote has, after asking; it never pushes (ADR-026). */
|
|
214
|
+
const REAUTHOR_FIX = 'fix: repown reauthor (on that branch: rewrites the unpushed ones as the pinned account; asks first, never pushes)';
|
|
213
215
|
/** Each commit shows the address that is WRONG -- the committer's, when the author is right. */
|
|
214
216
|
function foreignRefusal(ref, foreign, expected) {
|
|
215
217
|
const shown = foreign.slice(0, 10).map((commit) => {
|
|
@@ -221,7 +223,7 @@ function foreignRefusal(ref, foreign, expected) {
|
|
|
221
223
|
return {
|
|
222
224
|
reason: foreign.length + ' commit(s) bound for ' + ref.remoteRef +
|
|
223
225
|
' were not authored as ' + expected + ', or were committed by someone else.',
|
|
224
|
-
detail: [...shown, ...more, '', 'These addresses become permanent once pushed.'],
|
|
226
|
+
detail: [...shown, ...more, '', 'These addresses become permanent once pushed.', REAUTHOR_FIX],
|
|
225
227
|
};
|
|
226
228
|
}
|
|
227
229
|
/** A fetch cures a missing object; it does nothing for history git printed in a shape repown cannot parse. */
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// What a clone repown hasn't pinned commits as, read once for doctor and the start screen
|
|
2
|
+
// (ADR-033). Read-only. git's effective config is read from a fresh, empty folder outside any
|
|
3
|
+
// repository: no clone's own config takes part, and no `includeIf` folder rule applies, so
|
|
4
|
+
// the answer is the same wherever repown runs. That read sees what a `--global` read can miss:
|
|
5
|
+
// the XDG file beside ~/.gitconfig, and values set for every command (`-c`, GIT_CONFIG_*).
|
|
6
|
+
import { mkdtemp, rm } from 'node:fs/promises';
|
|
7
|
+
import { tmpdir } from 'node:os';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { Git } from './git.js';
|
|
10
|
+
import { hostileSet } from './guard/check.js';
|
|
11
|
+
import { copyableCommand } from './shell.js';
|
|
12
|
+
export async function readMachineDefault(env = process.env) {
|
|
13
|
+
const dir = await mkdtemp(join(tmpdir(), 'repown-default-'));
|
|
14
|
+
try {
|
|
15
|
+
return { ...await readFrom(new Git(dir)), emailVariable: !!env['EMAIL'], env: hostileSet(env) };
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
await rm(dir, { recursive: true, force: true });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function readFrom(git) {
|
|
22
|
+
const [name, email, useConfigOnly, files] = await Promise.all([
|
|
23
|
+
git.getConfig('user.name'), git.getConfig('user.email'),
|
|
24
|
+
git.getBoolConfig('user.useConfigOnly'), git.configOrigins('^(user\\.email|includeif\\..*\\.path)$'),
|
|
25
|
+
]);
|
|
26
|
+
const fromFile = files.filter((entry) => entry.key === 'user.email').at(-1);
|
|
27
|
+
// A value set for every command wins over every file, and has none.
|
|
28
|
+
const emailFile = fromFile && fromFile.value === email ? fromFile.file : null;
|
|
29
|
+
return { name, email, emailFile, useConfigOnly: useConfigOnly ?? false, includeIfs: files.flatMap(includeIf) };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What a commit in such a clone gets with no `user.email` (measured, git 2.50): useConfigOnly
|
|
33
|
+
* on refuses; otherwise git takes `EMAIL`, or makes one up from the user and host name.
|
|
34
|
+
*/
|
|
35
|
+
export function withoutEmail(machine) {
|
|
36
|
+
if (machine.useConfigOnly)
|
|
37
|
+
return "useConfigOnly is on, so a clone repown hasn't pinned can't commit";
|
|
38
|
+
return machine.emailVariable ? 'git uses the EMAIL variable instead' : "git makes one up from this machine's user and host name";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* How to make such a clone refuse to commit instead, printed and never run; null when it
|
|
42
|
+
* already does. useConfigOnly alone changes nothing while a default email is set.
|
|
43
|
+
*/
|
|
44
|
+
export function refuseAdvice(machine) {
|
|
45
|
+
if (!machine.email && machine.useConfigOnly)
|
|
46
|
+
return null;
|
|
47
|
+
const turnOn = copyableCommand(['git', 'config', '--global', 'user.useConfigOnly', 'true']) ?? '';
|
|
48
|
+
const lead = 'to make a clone repown hasn\'t pinned refuse to commit instead: ';
|
|
49
|
+
if (!machine.email)
|
|
50
|
+
return lead + turnOn;
|
|
51
|
+
const where = machine.emailFile ? 'remove user.email from ' + machine.emailFile : 'stop setting user.email for every command';
|
|
52
|
+
return lead + where + ', then ' + turnOn;
|
|
53
|
+
}
|
|
54
|
+
/** The recorded account whose commit email this is, ignoring case; null when none is. */
|
|
55
|
+
export function ownerOfEmail(email, registry) {
|
|
56
|
+
if (!email)
|
|
57
|
+
return null;
|
|
58
|
+
const wanted = email.toLowerCase();
|
|
59
|
+
const found = Object.entries(registry.accounts).find(([, account]) => account.email.toLowerCase() === wanted);
|
|
60
|
+
return found ? found[0] : null;
|
|
61
|
+
}
|
|
62
|
+
/** `includeif.<condition>.path`: git lowercases the section and the name, never the condition. */
|
|
63
|
+
function includeIf(entry) {
|
|
64
|
+
if (!entry.key.startsWith('includeif.') || !entry.key.endsWith('.path'))
|
|
65
|
+
return [];
|
|
66
|
+
return [{ condition: entry.key.slice('includeif.'.length, -'.path'.length), path: entry.value, file: entry.file }];
|
|
67
|
+
}
|
|
@@ -58,6 +58,9 @@ function ssoFix(link) {
|
|
|
58
58
|
function signInFix(ctx) {
|
|
59
59
|
if (isGh(ctx.helper))
|
|
60
60
|
return ['gh signs in as its active account; undo it: repown fix'];
|
|
61
|
+
// A username in the URL outranks the pin, so the URL is the fix (ADR-032), not a login as it.
|
|
62
|
+
if (urlNamesOther(ctx))
|
|
63
|
+
return [fromUrlFix(ctx.account)];
|
|
61
64
|
if (!ctx.helper)
|
|
62
65
|
return ['no credential helper serves this URL; install Git Credential Manager, then: repown doctor --online'];
|
|
63
66
|
if (!isGcm(ctx.helper))
|
|
@@ -65,6 +68,18 @@ function signInFix(ctx) {
|
|
|
65
68
|
const command = ctx.github && ctx.account ? gcmLogin(ctx.account) : null;
|
|
66
69
|
return [command ? 'sign in again: ' + command : 'sign in again through Git Credential Manager; a push in a terminal asks'];
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* The push URL names a user other than the pinned account, so removing it is the fix. The
|
|
73
|
+
* pinned account itself in the URL changes nothing: git sends the same name either way.
|
|
74
|
+
*/
|
|
75
|
+
export function urlNamesOther(ctx) {
|
|
76
|
+
if (!ctx.fromUrl)
|
|
77
|
+
return false;
|
|
78
|
+
return !ctx.account || !ctx.pinned || ctx.account.toLowerCase() !== ctx.pinned.toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
function fromUrlFix(user) {
|
|
81
|
+
return 'the push URL names ' + (user ?? 'a user') + ', so git signs in as it; remove it (repown status prints the command)';
|
|
82
|
+
}
|
|
68
83
|
/** GCM's sign-in for github.com (measured, GCM 2.6.1); null when no shell quotes the account. */
|
|
69
84
|
export function gcmLogin(account) {
|
|
70
85
|
return copyableCommand(['git', 'credential-manager', 'github', 'login', '--username', account, '--browser', '--force']);
|
|
@@ -89,7 +104,7 @@ function denied(as, ctx) {
|
|
|
89
104
|
if (ctx.account.toLowerCase() === pinned.toLowerCase())
|
|
90
105
|
return { level: 'fail', message, fix: storedFor(ctx) };
|
|
91
106
|
if (ctx.fromUrl)
|
|
92
|
-
return { level: 'fail', message, fix: [
|
|
107
|
+
return { level: 'fail', message, fix: [fromUrlFix(as)] };
|
|
93
108
|
const command = copyableCommand(['repown', 'use', pinned]);
|
|
94
109
|
return { level: 'fail', message, fix: [command ? 'use the pinned account: ' + command : 'pin ' + pinned + ' again with repown use'] };
|
|
95
110
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// edit). Everything else stays printed advice.
|
|
8
8
|
import { isGcm } from './credential/gcm.js';
|
|
9
9
|
import { isGh } from './credential/gh.js';
|
|
10
|
+
import { urlNamesOther } from './signin-check.js';
|
|
10
11
|
/** Null when there is nothing repown can run for this verdict. */
|
|
11
12
|
export function repairFor(verdict, ctx) {
|
|
12
13
|
if (verdict.kind === 'sso')
|
|
@@ -22,15 +23,15 @@ export function repairFor(verdict, ctx) {
|
|
|
22
23
|
*/
|
|
23
24
|
function deniedRepair(as, ctx) {
|
|
24
25
|
const same = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
25
|
-
if (ctx
|
|
26
|
+
if (urlNamesOther(ctx) || !ctx.pinned || !as || same(as, ctx.pinned) || !ctx.account)
|
|
26
27
|
return null;
|
|
27
28
|
return same(ctx.account, ctx.pinned) ? signInRepair(ctx) : { kind: 'use', account: ctx.pinned };
|
|
28
29
|
}
|
|
29
30
|
function signInRepair(ctx) {
|
|
30
31
|
if (isGh(ctx.helper))
|
|
31
32
|
return { kind: 'fix' };
|
|
32
|
-
// A username in the URL is the blocker to remove, never an account to sign in as.
|
|
33
|
-
return isGcm(ctx.helper) && ctx.github && ctx.account && !ctx
|
|
33
|
+
// A username in the URL other than the pin is the blocker to remove, never an account to sign in as.
|
|
34
|
+
return isGcm(ctx.helper) && ctx.github && ctx.account && !urlNamesOther(ctx) ? { kind: 'login', account: ctx.account } : null;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* The question before running it, or null when the repair asks its own: `repown fix` shows
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// What the start screen reads before it asks: the registry, whether gh is git's
|
|
2
|
-
// credential helper,
|
|
2
|
+
// credential helper, the machine default (who a clone repown hasn't pinned commits as,
|
|
3
|
+
// ADR-033), and the clones below this folder with their owners. Read-only. A directory
|
|
3
4
|
// it cannot list is skipped; `repown scan` is the command that reports those.
|
|
4
5
|
import { readdir } from 'node:fs/promises';
|
|
5
6
|
import { join, relative, resolve, sep } from 'node:path';
|
|
@@ -11,11 +12,13 @@ import { loadRegistry } from '../core/registry.js';
|
|
|
11
12
|
import { identityProblems } from '../commands/status.js';
|
|
12
13
|
import { CONCURRENCY, discover, mapLimited } from '../commands/scan.js';
|
|
13
14
|
import { signedInLogins } from './setup-flow.js';
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
import { readMachineDefault } from '../core/machine-default.js';
|
|
16
|
+
/** How many levels below this folder the start screen looks: `repown scan`'s default (ADR-033). */
|
|
17
|
+
export const HOME_DEPTH = 3;
|
|
16
18
|
export async function readHome(cwd, deps = {}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
+
const machine = deps.machine ? deps.machine() : readMachineDefault();
|
|
20
|
+
const [registry, ghIsHelper, defaults, clones] = await Promise.all([registryOf(deps), helperOf(cwd, deps), machine, clonesOf(cwd, deps)]);
|
|
21
|
+
return { cwd: resolve(cwd), registry, ghIsHelper, machine: defaults, clones };
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Global user.name and user.email, shown beside a new account's and never filled in: read only
|
|
@@ -97,7 +100,7 @@ async function describeClone(dir, deps) {
|
|
|
97
100
|
const repo = await inspect(snapshotOf(new Git(dir)));
|
|
98
101
|
if (!repo.isRepo)
|
|
99
102
|
return null;
|
|
100
|
-
return { path: resolve(dir), setUp: identityProblems(repo).length === 0 };
|
|
103
|
+
return { path: resolve(dir), setUp: identityProblems(repo).length === 0, owner: repo.owner, ownerHost: repo.owner ? repo.ownerProvider.id : null };
|
|
101
104
|
}
|
|
102
105
|
function isClone(clone) {
|
|
103
106
|
return clone !== null;
|
package/dist/wizard/home-flow.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { relative } from 'node:path';
|
|
4
4
|
import { registryPath } from '../core/registry.js';
|
|
5
5
|
import { HOME_DEPTH } from './home-context.js';
|
|
6
|
-
import { CD_NOTE, CHECK_MACHINE, HELPER_LINE, HINT_ACCOUNT, HINT_DOCTOR, HINT_FIX, HINT_REMOVE, NONE_RECORDED, NOT_SET_UP, QUIT, RECORD_ACCOUNT, REMOVE_ACCOUNT, SET_UP, SETUP_CLONE, SHOW_HELP, STOP_GH, clonesNone, clonesSome, couldNotRead, moreClones, recordedLine, setupHint, unreadableLine, } from './home-text.js';
|
|
6
|
+
import { CD_NOTE, CHECK_MACHINE, HELPER_LINE, HINT_ACCOUNT, HINT_DOCTOR, HINT_FIX, HINT_REMOVE, NONE_RECORDED, NOT_SET_UP, QUIT, RECORD_ACCOUNT, REMOVE_ACCOUNT, SET_UP, SETUP_CLONE, SHOW_HELP, STOP_GH, clonesNone, clonesSome, couldNotRead, defaultLine, moreClones, recordedLine, setupHint, shellLine, unreadableLine, } from './home-text.js';
|
|
7
|
+
import { ownerOfEmail, withoutEmail } from '../core/machine-default.js';
|
|
7
8
|
import { addAccountArgv, printable } from './setup-flow.js';
|
|
8
9
|
/** Shown choices. `back` returns to the menu; the others run a command or leave. */
|
|
9
10
|
export const MENU = {
|
|
@@ -12,10 +13,21 @@ export const MENU = {
|
|
|
12
13
|
export const BACK = 'back';
|
|
13
14
|
const LIST_CAP = 20;
|
|
14
15
|
export function summaryLines(home) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return [
|
|
17
|
+
row('Accounts', accountsText(home.registry)),
|
|
18
|
+
...(home.ghIsHelper ? [row('Helper', HELPER_LINE)] : []),
|
|
19
|
+
row('Default', defaultText(home)),
|
|
20
|
+
...(home.machine.env.length > 0 ? [row('Shell', shellLine(home.machine.env))] : []),
|
|
21
|
+
row('Clones', clonesText(home)),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
/** Read-only (ADR-033): the address is the user's own, shown in their own terminal. */
|
|
25
|
+
function defaultText(home) {
|
|
26
|
+
const { email } = home.machine;
|
|
27
|
+
if (!email)
|
|
28
|
+
return 'none set: ' + withoutEmail(home.machine);
|
|
29
|
+
const owner = home.registry.ok ? ownerOfEmail(email, home.registry.value) : undefined;
|
|
30
|
+
return printable(defaultLine(email, owner));
|
|
19
31
|
}
|
|
20
32
|
export function homeNote(home) {
|
|
21
33
|
return home.clones.length === 0 ? CD_NOTE : null;
|
|
@@ -71,11 +83,22 @@ function accountsSummary(registry) {
|
|
|
71
83
|
return unreadableLine(names.length, unread, registryPath());
|
|
72
84
|
return names.length === 0 ? NONE_RECORDED : recordedLine(names.map(printable));
|
|
73
85
|
}
|
|
74
|
-
function clonesText(clones) {
|
|
86
|
+
function clonesText({ clones, registry }) {
|
|
75
87
|
if (clones.length === 0)
|
|
76
88
|
return clonesNone(HOME_DEPTH);
|
|
77
|
-
const pending = clones.filter((clone) => !clone.setUp)
|
|
78
|
-
|
|
89
|
+
const pending = clones.filter((clone) => !clone.setUp);
|
|
90
|
+
const owned = pending.filter((clone) => ownedBy(clone, registry)).length;
|
|
91
|
+
return clonesSome(clones.length, pending.length, clones.length - pending.length, owned);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The push URL's owner is a recorded account on that host: logins compare without case, as
|
|
95
|
+
* hosts do, and an account recorded for one host never owns a clone on another.
|
|
96
|
+
*/
|
|
97
|
+
function ownedBy(clone, registry) {
|
|
98
|
+
if (!clone.owner || !registry.ok)
|
|
99
|
+
return false;
|
|
100
|
+
const owner = clone.owner.toLowerCase();
|
|
101
|
+
return Object.entries(registry.value.accounts).some(([login, account]) => login.toLowerCase() === owner && (!account.host || account.host === clone.ownerHost));
|
|
79
102
|
}
|
|
80
103
|
function setupItem(home) {
|
|
81
104
|
if (home.clones.length === 0)
|
package/dist/wizard/home-text.js
CHANGED
|
@@ -54,8 +54,21 @@ export function couldNotRead(path) {
|
|
|
54
54
|
export function clonesNone(depth) {
|
|
55
55
|
return 'none below this folder (' + depth + ' levels)';
|
|
56
56
|
}
|
|
57
|
-
export function clonesSome(total, pending, ready) {
|
|
58
|
-
|
|
57
|
+
export function clonesSome(total, pending, ready, owned = 0) {
|
|
58
|
+
const yours = owned > 0 ? ' (' + owned + ' owned by your accounts)' : '';
|
|
59
|
+
return total + ' below this folder: ' + pending + ' not set up' + yours + ', ' + ready + ' set up';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Who a clone repown hasn't pinned commits as, and whose that is: `undefined` when the
|
|
63
|
+
* registry couldn't be read, so a skipped check never reads as "not a recorded account".
|
|
64
|
+
*/
|
|
65
|
+
export function defaultLine(email, owner) {
|
|
66
|
+
if (owner === undefined)
|
|
67
|
+
return 'commits as ' + email;
|
|
68
|
+
return 'commits as ' + email + ' · ' + (owner ? owner + "'s" : 'not a recorded account');
|
|
69
|
+
}
|
|
70
|
+
export function shellLine(names) {
|
|
71
|
+
return names.join(', ') + ' set: the guard refuses pushes while ' + (names.length === 1 ? 'it is' : 'they are');
|
|
59
72
|
}
|
|
60
73
|
export function setupHint(pending, total) {
|
|
61
74
|
return pending > 0 ? pending + ' not set up' : total + ' set up';
|
package/dist/wizard/setup-run.js
CHANGED
|
@@ -198,12 +198,20 @@ async function runGuided(given, ctx, guided) {
|
|
|
198
198
|
return stoppedBefore(outcome.status, guided.prompter);
|
|
199
199
|
return runAccepted(outcome.answers, ctx, guided);
|
|
200
200
|
}
|
|
201
|
-
/**
|
|
201
|
+
/**
|
|
202
|
+
* Already set up: nothing to run, and the sign-in check is still offered, as after a run only
|
|
203
|
+
* with nothing in the way of the next push (ADR-032); the review above listed what is.
|
|
204
|
+
*/
|
|
202
205
|
async function settled({ git, prompter, signIn }) {
|
|
203
206
|
prompter.outro?.('Nothing changed: this clone was already set up');
|
|
204
207
|
if (!signIn)
|
|
205
208
|
return 0;
|
|
206
209
|
prompter.close();
|
|
210
|
+
const first = await firstBlocking(git);
|
|
211
|
+
if (first) {
|
|
212
|
+
out.detail(out.marked('warn', process.stderr, 'sign-in not checked online: the next push will fail: ' + printable(first.summary)));
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
207
215
|
const online = await signInAfterSetup(signIn, git);
|
|
208
216
|
if (online)
|
|
209
217
|
out.detail(signInLine(online));
|
|
@@ -395,6 +403,11 @@ function closing({ account, found }, online) {
|
|
|
395
403
|
for (const line of found.flatMap((blocker) => blocker.lines))
|
|
396
404
|
out.detail(indent + printable(line));
|
|
397
405
|
}
|
|
406
|
+
/** What stops the next push of a settled clone, read now; none without a pinned account. */
|
|
407
|
+
async function firstBlocking(git) {
|
|
408
|
+
const account = await git.getConfig('repown.account', 'local');
|
|
409
|
+
return account ? (await blockersNow(git, account)).find((blocker) => blocker.blocks) : undefined;
|
|
410
|
+
}
|
|
398
411
|
/** Re-read after the run: a step may have fixed what the review showed, or not. */
|
|
399
412
|
async function blockersNow(git, account) {
|
|
400
413
|
const email = await git.getConfig('user.email', 'local') ?? '';
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "repown",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.8.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"bin": {
|
|
12
12
|
"repown": "dist/cli.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Use several git accounts on one machine: each repo owns its identity, so you move between repos with no switch command and never push the wrong one.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|