repown 0.5.3 → 0.5.5

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 CHANGED
@@ -7,6 +7,24 @@ commands. How a release is cut: [docs/RELEASING.md](docs/RELEASING.md).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.5] - 2026-11-27
11
+
12
+ ### Fixed
13
+ - `repown fix` said "nothing to undo -- gh is not installed as a credential helper" while
14
+ `repown doctor` reported gh as the helper, when `gh auth setup-git`'s entries sat in a
15
+ file your git config includes (`include.path`, for example `~/.gitconfig.local`). `fix`
16
+ now finds them there, removes them from that file, and its preview names the file.
17
+ - A `user.name` or `user.email` kept in a file your global config includes is now shown as
18
+ the machine default by setup and `repown status`.
19
+
20
+ ## [0.5.4] - 2026-10-12
21
+
22
+ ### Changed
23
+ - Reading a clone starts up to three fewer git processes (about 75 ms each on
24
+ Windows): the guard's state now comes from the hook location already read, and the
25
+ sign-in and later-push-URL checks share one read of origin's push URLs. Output is
26
+ unchanged.
27
+
10
28
  ## [0.5.3] - 2026-10-11
11
29
 
12
30
  ### Fixed
@@ -326,7 +344,9 @@ and cmd. `status`, `doctor` and the pre-push guard are faster on Windows.
326
344
  contract for scripts.
327
345
  - Runs on Node 20+ on Windows, macOS and Linux, with zero runtime dependencies.
328
346
 
329
- [Unreleased]: https://github.com/makubexD/repown/compare/v0.5.3...HEAD
347
+ [Unreleased]: https://github.com/makubexD/repown/compare/v0.5.5...HEAD
348
+ [0.5.5]: https://github.com/makubexD/repown/compare/v0.5.4...v0.5.5
349
+ [0.5.4]: https://github.com/makubexD/repown/compare/v0.5.3...v0.5.4
330
350
  [0.5.3]: https://github.com/makubexD/repown/compare/v0.5.2...v0.5.3
331
351
  [0.5.2]: https://github.com/makubexD/repown/compare/v0.5.1...v0.5.2
332
352
  [0.5.1]: https://github.com/makubexD/repown/compare/v0.5.0...v0.5.1
@@ -54,8 +54,10 @@ function preview(planned) {
54
54
  }
55
55
  /** What `fix` would remove, and the undo. `repown setup` shows the same lines in its review. */
56
56
  export function previewLines(planned) {
57
+ // The file is named: it may be one the scope includes, not the file the user expects (ADR-030).
57
58
  const entries = planned.flatMap((entry) => [
58
59
  ' ' + entry.scope + ': ' + entry.key,
60
+ ' in ' + entry.file,
59
61
  ...entry.values.map((value) => ' = ' + describeValue(value)),
60
62
  ]);
61
63
  return [
@@ -85,6 +87,7 @@ function reportRemovals(results) {
85
87
  continue;
86
88
  }
87
89
  out.warn('fix', 'could NOT remove ' + entry.scope + ': ' + entry.key);
90
+ out.detail('in ' + entry.file);
88
91
  if (entry.scope === 'system')
89
92
  out.detail('the system scope is machine-wide; re-run this in an ELEVATED shell.');
90
93
  }
@@ -1,9 +1,9 @@
1
- // Config reads answered from one `git config [--scope] --list -z` per scope, read on first
2
- // use, for code that only reads (ADR-029). A plain `--get` or `--get-all` is answered with
1
+ // Config reads answered from one `git config [--scope [--includes]] --list -z` per scope, read on
2
+ // first use, for code that only reads (ADR-029, ADR-030). A plain `--get` or `--get-all` is answered with
3
3
  // the output git itself would print for it, so Git's parsing of that output is unchanged.
4
4
  // Other config queries (`--type=bool`, `--get-urlmatch`, `--show-origin --get-regexp`) and
5
5
  // every non-config call go to git. A config write refuses.
6
- import { Git } from './git.js';
6
+ import { Git, followsIncludes } from './git.js';
7
7
  import { succeeded } from './exec.js';
8
8
  const SCOPE_FLAGS = new Map([['--local', 'local'], ['--global', 'global'], ['--system', 'system']]);
9
9
  /** The first argument after `config` and its scope: the query git is asked, never a value. */
@@ -13,10 +13,11 @@ export class ConfigSnapshot extends Git {
13
13
  exec(args, input) {
14
14
  if (args[0] !== 'config')
15
15
  return this.spawnGit(args, input);
16
- const read = configRead(args);
16
+ const query = withoutIncludes(args);
17
+ const read = configRead(query);
17
18
  if (read)
18
19
  return this.answer(read);
19
- if (PASSED_THROUGH.has(actionOf(args) ?? ''))
20
+ if (PASSED_THROUGH.has(actionOf(query) ?? ''))
20
21
  return this.spawnGit(args, input);
21
22
  return Promise.reject(new Error('a config snapshot only reads: git ' + args.join(' ')));
22
23
  }
@@ -60,8 +61,18 @@ export function snapshotOf(git) {
60
61
  throw new Error('snapshotOf takes a plain Git, not ' + git.constructor.name);
61
62
  return new ConfigSnapshot(git.cwd);
62
63
  }
64
+ /** A global or system list follows includes, as those reads from Git do; local does not (ADR-030). */
63
65
  function listArgs(scope) {
64
- return scope ? ['config', '--' + scope, '--list', '-z'] : ['config', '--list', '-z'];
66
+ if (!scope)
67
+ return ['config', '--list', '-z'];
68
+ return ['config', '--' + scope, ...(followsIncludes(scope) ? ['--includes'] : []), '--list', '-z'];
69
+ }
70
+ /**
71
+ * The query without the `--includes` a scoped read carries: a snapshot's lists already follow
72
+ * includes. Only the flag right after the scope is dropped, so a value is never touched.
73
+ */
74
+ function withoutIncludes(args) {
75
+ return SCOPE_FLAGS.has(args[1] ?? '') && args[2] === '--includes' ? [...args.slice(0, 2), ...args.slice(3)] : args;
65
76
  }
66
77
  function missingFileIsEmpty(listed) {
67
78
  return !succeeded(listed) && /unable to read config file/.test(listed.stderr) ? answered(0, '') : listed;
@@ -27,25 +27,31 @@
27
27
  // machine-wide and needs an elevated shell.
28
28
  import { isGh } from './gh.js';
29
29
  const SCOPES = ['local', 'global', 'system'];
30
- const HOSTS = ['https://github.com', 'https://gist.github.com'];
30
+ /** The helper key of github.com and gist.github.com, the two hosts gh writes. */
31
+ const HELPER_KEYS = '^credential\\.https://(gist\\.)?github\\.com\\.helper$';
31
32
  /**
32
- * What `repair` would remove, without removing it: on each key, gh's values and
33
- * the empty reset gh writes with them. A key holding no gh value is not listed,
34
- * and any other helper on a listed key stays -- `gh auth setup-git`, the undo,
33
+ * What `repair` would remove, without removing it: on each key in each file, gh's
34
+ * values and the empty reset gh writes with them. A key holding no gh value is not
35
+ * listed, and any other helper on a listed key stays -- `gh auth setup-git`, the undo,
35
36
  * would never bring it back.
36
37
  */
37
38
  export async function planRepair(git) {
38
- const found = [];
39
- for (const scope of SCOPES) {
40
- for (const host of HOSTS) {
41
- const key = 'credential.' + host + '.helper';
42
- const values = await git.getAllConfigRaw(key, scope);
43
- if (!values.some(isGh))
44
- continue;
45
- found.push({ scope, key, values: ghEntries(values), removed: false });
46
- }
39
+ const read = await Promise.all(SCOPES.map((scope) => git.configOrigins(HELPER_KEYS, scope)));
40
+ return SCOPES.flatMap((scope, index) => plannedIn(scope, read[index]));
41
+ }
42
+ /** One outcome per (file, key) holding gh's value: gh writes its reset and value together. */
43
+ function plannedIn(scope, entries) {
44
+ const byFileAndKey = new Map();
45
+ for (const entry of entries) {
46
+ const id = entry.file + '\0' + entry.key;
47
+ byFileAndKey.set(id, [...(byFileAndKey.get(id) ?? []), entry]);
47
48
  }
48
- return found;
49
+ return [...byFileAndKey.values()].flatMap((group) => {
50
+ const values = group.map((entry) => entry.value);
51
+ if (!values.some(isGh))
52
+ return [];
53
+ return [{ scope, file: group[0].file, key: group[0].key, values: ghEntries(values), removed: false }];
54
+ });
49
55
  }
50
56
  /** gh's value, or an empty reset sitting directly before one -- the pair gh writes. */
51
57
  function isGhEntry(values, index) {
@@ -57,21 +63,30 @@ function ghEntries(values) {
57
63
  }
58
64
  /**
59
65
  * git can remove a value by PATTERN, not by position -- and two empty resets are
60
- * the same pattern, only one of them gh's. So the key is rewritten: unset, then
61
- * every value that is not gh's added back, in its original order.
66
+ * the same pattern, only one of them gh's. So the key is rewritten in its file:
67
+ * unset, then every value that is not gh's added back, in its original order.
62
68
  */
63
69
  export async function repair(git) {
64
70
  const results = [];
65
- for (const entry of await planRepair(git)) {
66
- const all = await git.getAllConfigRaw(entry.key, entry.scope);
67
- const kept = all.filter((_, index) => !isGhEntry(all, index));
68
- let removed = await git.unsetConfig(entry.key, entry.scope);
69
- for (const value of kept)
70
- removed = await git.addConfig(entry.key, value, entry.scope) && removed;
71
- results.push({ ...entry, removed });
72
- }
71
+ for (const entry of await planRepair(git))
72
+ results.push({ ...entry, removed: await rewrite(git, entry) });
73
73
  return results;
74
74
  }
75
+ /**
76
+ * That file's own values of the key, gh's left out. A local entry goes through `--local`:
77
+ * git prints its origin relative to the worktree (`.git/config`), which `--file=` would
78
+ * resolve against the cwd, and local reads don't follow includes. A global or system origin
79
+ * is absolute, and named outright, so its own includes are not read.
80
+ */
81
+ async function rewrite(git, entry) {
82
+ const target = entry.scope === 'local' ? 'local' : { file: entry.file };
83
+ const all = await git.getAllConfigRaw(entry.key, target);
84
+ const kept = all.filter((_, index) => !isGhEntry(all, index));
85
+ let removed = await git.unsetConfig(entry.key, target);
86
+ for (const value of kept)
87
+ removed = await git.addConfig(entry.key, value, target) && removed;
88
+ return removed;
89
+ }
75
90
  /**
76
91
  * An empty value is the list reset, and saying so is the whole point of showing
77
92
  * the values at all -- on its own the blank line reads like a formatting bug
package/dist/core/git.js CHANGED
@@ -154,20 +154,34 @@ export class Git {
154
154
  return output(await this.exec(['rev-parse', '--git-path', 'hooks']));
155
155
  }
156
156
  // ---- config -------------------------------------------------------------
157
- scoped(scope, args) {
158
- return scope ? ['config', `--${scope}`, ...args] : ['config', ...args];
157
+ /** argv addressed to a scope's own file, or to one file named outright: every write. */
158
+ scoped(target, args) {
159
+ if (target === undefined)
160
+ return ['config', ...args];
161
+ return ['config', typeof target === 'string' ? `--${target}` : `--file=${target.file}`, ...args];
162
+ }
163
+ /**
164
+ * A read's argv. git follows include.path only when no scope is named, unless told to:
165
+ * without --includes a global or system read misses a value kept in a file it includes,
166
+ * which git itself applies (ADR-030). A local read stays bare: a clone's include can name a
167
+ * file the repository tracks, and committed content must not set the guard's own keys.
168
+ * A file named outright is read on its own.
169
+ */
170
+ reading(target, args) {
171
+ const scoped = this.scoped(target, args);
172
+ return followsIncludes(target) ? [...scoped.slice(0, 2), '--includes', ...scoped.slice(2)] : scoped;
159
173
  }
160
174
  /** The value, or null when unset. Omit `scope` to read what git would EFFECTIVELY use. */
161
175
  async getConfig(key, scope) {
162
- return output(await this.exec(this.scoped(scope, ['--get', key])));
176
+ return output(await this.exec(this.reading(scope, ['--get', key])));
163
177
  }
164
178
  /** Effective boolean, or null when unset or not a bool. Omit `scope` for any-scope. */
165
179
  async getBoolConfig(key, scope) {
166
- const value = output(await this.exec(this.scoped(scope, ['--type=bool', '--get', key])));
180
+ const value = output(await this.exec(this.reading(scope, ['--type=bool', '--get', key])));
167
181
  return value === 'true' ? true : value === 'false' ? false : null;
168
182
  }
169
183
  async getAllConfig(key, scope) {
170
- return lines(await this.exec(this.scoped(scope, ['--get-all', key])));
184
+ return lines(await this.exec(this.reading(scope, ['--get-all', key])));
171
185
  }
172
186
  /**
173
187
  * Every value of a multi-valued key, INCLUDING empty ones.
@@ -179,8 +193,8 @@ export class Git {
179
193
  * stopped working. Filtering it out made `repown fix` preview two values while
180
194
  * removing four, and hid the one the explanation is actually about.
181
195
  */
182
- async getAllConfigRaw(key, scope) {
183
- const result = await this.exec(this.scoped(scope, ['--get-all', key]));
196
+ async getAllConfigRaw(key, target) {
197
+ const result = await this.exec(this.reading(target, ['--get-all', key]));
184
198
  if (!succeeded(result))
185
199
  return [];
186
200
  // git ends every value with LF on every platform, so a CR is part of a value: kept.
@@ -195,12 +209,12 @@ export class Git {
195
209
  return succeeded(await this.exec(this.scoped(scope, [key, value])));
196
210
  }
197
211
  /** Appends one more value to a multi-valued key. */
198
- async addConfig(key, value, scope) {
199
- return succeeded(await this.exec(this.scoped(scope, ['--add', key, value])));
212
+ async addConfig(key, value, target) {
213
+ return succeeded(await this.exec(this.scoped(target, ['--add', key, value])));
200
214
  }
201
215
  /** True when the key is gone afterwards -- including when it was never set. */
202
- async unsetConfig(key, scope = 'local') {
203
- const result = await this.exec(this.scoped(scope, ['--unset-all', key]));
216
+ async unsetConfig(key, target = 'local') {
217
+ const result = await this.exec(this.scoped(target, ['--unset-all', key]));
204
218
  return succeeded(result) || result.code === 5; // 5 = the key did not exist
205
219
  }
206
220
  /**
@@ -215,10 +229,13 @@ export class Git {
215
229
  async getUrlMatch(key, url) {
216
230
  return output(await this.exec(['config', '--get-urlmatch', key, url]));
217
231
  }
218
- /** Which FILE each matching key lives in, so a repair edits the scope that holds it. */
232
+ /**
233
+ * Which FILE each matching value lives in, so a repair edits the file that holds it: with a
234
+ * scope, an included file too, under the scope that includes it (ADR-030).
235
+ */
219
236
  async configOrigins(pattern, scope) {
220
- const args = this.scoped(scope, ['--show-origin', '--get-regexp', pattern]);
221
- return lines(await this.exec(args)).flatMap(parseOriginLine);
237
+ const result = await this.exec(this.reading(scope, ['--show-origin', '-z', '--get-regexp', pattern]));
238
+ return succeeded(result) ? parseOrigins(result.stdout) : [];
222
239
  }
223
240
  // ---- history ------------------------------------------------------------
224
241
  /**
@@ -426,16 +443,28 @@ export class Git {
426
443
  return ok(counts);
427
444
  }
428
445
  }
446
+ /** The machine's own scopes, whose includes are the user's files (ADR-030). */
447
+ export function followsIncludes(target) {
448
+ return target === 'global' || target === 'system';
449
+ }
429
450
  /**
430
- * `file:<path>\t<key> <value>`. The path is printed UNQUOTED and may hold
431
- * spaces (`C:/Program Files/Git/etc/gitconfig`), so it ends at the TAB, not at
432
- * the first space.
451
+ * `--show-origin -z --get-regexp`: `<origin>\0<key>\n<value>\0` per value, a key with no
452
+ * `=` written without the newline. NUL can't occur in a path, key or value, so a path with
453
+ * spaces or a value with a tab or newline comes back whole. Only a `file:` origin can be
454
+ * edited; a command-line or blob one is left out.
433
455
  */
434
- function parseOriginLine(line) {
435
- const match = /^file:([^\t]+)\t(\S+)(?: (.*))?$/.exec(line);
436
- if (!match)
437
- return [];
438
- return [{ file: match[1], key: match[2], value: match[3] ?? '' }];
456
+ function parseOrigins(stdout) {
457
+ const fields = stdout.split('\0');
458
+ const entries = [];
459
+ for (let index = 0; index + 1 < fields.length; index += 2) {
460
+ const origin = fields[index];
461
+ const pair = fields[index + 1];
462
+ if (!origin.startsWith('file:'))
463
+ continue;
464
+ const newline = pair.indexOf('\n');
465
+ entries.push({ file: origin.slice('file:'.length), key: newline < 0 ? pair : pair.slice(0, newline), value: newline < 0 ? '' : pair.slice(newline + 1) });
466
+ }
467
+ return entries;
439
468
  }
440
469
  /**
441
470
  * NUL-terminated fields, subject LAST. git refuses NUL in a name or an address,
@@ -51,10 +51,6 @@ async function hookDirs(git) {
51
51
  return null;
52
52
  return { own: join(resolve(git.cwd, common), 'hooks'), effective: resolve(git.cwd, hooks) };
53
53
  }
54
- /** The pre-push hook git will actually RUN -- through core.hooksPath if that is set. */
55
- export async function hookPath(git) {
56
- return (await hookLocation(git))?.path ?? null;
57
- }
58
54
  export async function hookLocation(git) {
59
55
  const dirs = await hookDirs(git);
60
56
  return dirs ? { path: join(dirs.effective, 'pre-push'), redirected: isRedirected(dirs) } : null;
@@ -88,8 +84,14 @@ function redirectMessage(dirs) {
88
84
  'pre-push hook run: repown guard check --remote="$1" --url="$2"';
89
85
  }
90
86
  export async function guardState(git) {
91
- const path = await hookPath(git);
92
- return path ? stateOf(path) : 'off';
87
+ return guardStateAt(await hookLocation(git));
88
+ }
89
+ /**
90
+ * The guard's state at a location already read, so one read need not ask git twice. Only a
91
+ * location from this same read: after a write or a wait, read it again (ADR-029).
92
+ */
93
+ export async function guardStateAt(location) {
94
+ return location ? stateOf(location.path) : 'off';
93
95
  }
94
96
  /**
95
97
  * The PATH fallback trusts a `repown` only if it SAYS it is repown. Without this, any
@@ -9,7 +9,7 @@
9
9
  import { parseGitUrl } from './url.js';
10
10
  import { providerFor } from './hosts/index.js';
11
11
  import { readIdentity } from './identity.js';
12
- import { guardState, hookLocation } from './guard/hook.js';
12
+ import { guardStateAt, hookLocation } from './guard/hook.js';
13
13
  import { findGcm, listAccounts, isGcm } from './credential/gcm.js';
14
14
  import { ghState, ghInstalled, isGh } from './credential/gh.js';
15
15
  const DEFAULT_PROBE_URL = 'https://github.com/';
@@ -18,14 +18,14 @@ export async function inspectRepo(git) {
18
18
  const originUrl = isRepo ? await git.getConfig('remote.origin.url') : null;
19
19
  const url = originUrl ? parseGitUrl(originUrl) : null;
20
20
  const sides = await originSides(git, originUrl);
21
- const [root, branch, hook, identity, guard, helper] = await Promise.all([
21
+ const [root, branch, hook, identity, helper] = await Promise.all([
22
22
  isRepo ? git.root() : Promise.resolve(null),
23
23
  isRepo ? git.currentBranch() : Promise.resolve(null),
24
24
  isRepo ? hookLocation(git) : Promise.resolve(null),
25
25
  readIdentity(git, sides.credential.keys[0] ?? null),
26
- isRepo ? guardState(git) : Promise.resolve('off'),
27
26
  git.getUrlMatch('credential.helper', sides.credential.url ?? DEFAULT_PROBE_URL),
28
27
  ]);
28
+ const guard = await guardStateAt(hook);
29
29
  return {
30
30
  git, isRepo, root, branch, originUrl, url, provider: providerFor(url),
31
31
  owner: sides.owner, ownerProvider: sides.ownerProvider,
@@ -16,8 +16,14 @@ export async function readPushFacts(git, unpushed, env = process.env) {
16
16
  const branch = head?.kind === 'branch' ? head.name : null;
17
17
  const target = branch ? await pushTarget(git, branch) : null;
18
18
  const rewritable = await rewritableOf(git, target);
19
+ // A remote target's push URLs, read once for the sign-in and later-URL checks.
20
+ const pushed = target?.isRemote ? git.remoteUrls(target.name, true) : null;
19
21
  const [configOverrides, signin, repoint, destination, laterUrls, divergence, elsewhere, upstream] = await Promise.all([
20
- overridesIn(git), signinOf(git, target, rewritable !== null), repointOf(git, branch), rewritable ? null : destinationOf(git, target), laterUrlsOf(git, target),
22
+ overridesIn(git),
23
+ signinOf(git, target, { rewritable: rewritable !== null, pushed }),
24
+ repointOf(git, branch),
25
+ rewritable ? null : destinationOf(git, target),
26
+ laterUrlsOf(git, target, pushed),
21
27
  divergenceOf(git, target), elsewhereOf(git, target), upstreamOf(git, branch, target),
22
28
  ]);
23
29
  return {
@@ -34,8 +40,9 @@ function carriesSecret(raw) {
34
40
  const user = raw ? parseGitUrl(raw)?.user : null;
35
41
  return !!user && (user.includes(':') || /^(gh[pousr]_|github_pat_)/i.test(user));
36
42
  }
37
- async function signinOf(git, target, rewritable) {
38
- const found = target?.isRemote ? await remoteSignin(git, target.name) : target && !rewritable ? await bareSignin(git, target) : null;
43
+ async function signinOf(git, target, { rewritable, pushed }) {
44
+ const found = pushed && target ? await remoteSignin(git, target.name, await pushed)
45
+ : target && !rewritable ? await bareSignin(git, target) : null;
39
46
  if (found)
40
47
  return found;
41
48
  const headers = await git.configOrigins('^http\\.(.*\\.)?extraheader$');
@@ -57,8 +64,7 @@ async function bareSignin(git, target) {
57
64
  * adds is found and one a rule takes out is not. A URL that is a configured value is named
58
65
  * by its key; any other came from a rewrite, and only the remote is named.
59
66
  */
60
- async function remoteSignin(git, remote) {
61
- const pushed = await git.remoteUrls(remote, true);
67
+ async function remoteSignin(git, remote, pushed) {
62
68
  if (!pushed.ok)
63
69
  return configuredSignin(git, remote);
64
70
  const signed = pushed.value.find(carriesSecret);
@@ -96,10 +102,10 @@ async function destinationOf(git, target) {
96
102
  const allowed = (await git.getAllConfig('repown.allowOwner', 'local')).map((value) => value.toLowerCase());
97
103
  return { remote: target.isRemote ? target.name : null, owner, allowed };
98
104
  }
99
- async function laterUrlsOf(git, target) {
100
- if (!target?.isRemote)
105
+ async function laterUrlsOf(git, target, pushed) {
106
+ if (!target?.isRemote || !pushed)
101
107
  return null;
102
- const urls = [...new Set(await pushUrlsOf(git, target.name))];
108
+ const urls = [...new Set(await pushUrlsOf(git, target.name, await pushed))];
103
109
  if (urls.length < 2)
104
110
  return null;
105
111
  const owners = urls.slice(1).flatMap((raw) => {
@@ -112,8 +118,7 @@ async function laterUrlsOf(git, target) {
112
118
  return { remote: target.name, owners, allowed };
113
119
  }
114
120
  /** Every URL git pushes `remote` with; a git that cannot list them gets the configured values. */
115
- async function pushUrlsOf(git, remote) {
116
- const listed = await git.remoteUrls(remote, true);
121
+ async function pushUrlsOf(git, remote, listed) {
117
122
  if (listed.ok)
118
123
  return listed.value;
119
124
  const pushurls = await git.getAllConfig('remote.' + remote + '.pushurl');
@@ -25,7 +25,7 @@ import { plainPrompter } from './plain.js';
25
25
  import { COMMAND_MARK } from './review-text.js';
26
26
  import { blockers } from '../core/blockers.js';
27
27
  import { readPushFacts } from '../core/push-state.js';
28
- import { guardState, hookLocation } from '../core/guard/hook.js';
28
+ import { guardStateAt, hookLocation } from '../core/guard/hook.js';
29
29
  import { readUnpushed } from '../core/unpushed.js';
30
30
  const CANCELLED = 130;
31
31
  export async function runSetup(args, deps) {
@@ -365,7 +365,8 @@ function closing(account, found) {
365
365
  /** Re-read after the run: a step may have fixed what the review showed, or not. */
366
366
  async function blockersNow(git, account) {
367
367
  const email = await git.getConfig('user.email', 'local') ?? '';
368
- const [facts, guard, hook] = await Promise.all([readPushFacts(git, await readUnpushed(git)), guardState(git), hookLocation(git)]);
368
+ const [facts, hook] = await Promise.all([readPushFacts(git, await readUnpushed(git)), hookLocation(git)]);
369
+ const guard = await guardStateAt(hook);
369
370
  return blockers(facts, { email, account, autoUpstream: false, guarded: guard !== 'off' || hook?.redirected === true });
370
371
  }
371
372
  async function printClone(before, state) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "repown",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "repown",
9
- "version": "0.5.3",
9
+ "version": "0.5.5",
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.5.3",
3
+ "version": "0.5.5",
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",