| … | … | @@ -27,6 +27,10 @@ export const usage = `pgh repo — browse repos served by the daemon |
| 27 | 27 | pgh repo writers <name> List writers |
| 28 | 28 | pgh repo grant-writer <name> --peer <url> [--role owner|writer] |
| 29 | 29 | Admin: grant a peer push authority |
| 30 | pgh repo set-head <name> <branch> Set the repo's DEFAULT BRANCH fleet-wide |
| 31 | (replicated; admin; run on the tracker |
| 32 | owner). Accepts main or |
| 33 | refs/heads/main. |
| 30 | 34 | pgh repo local-key <name> Print this daemon's tracker local key |
| 31 | 35 | pgh repo revoke <name> <userId> Revoke a writer |
| 32 | 36 | pgh repo resync <name> Heal a stuck tracker: clean re-join in |
| … | … | @@ -66,6 +70,17 @@ export async function run (client, args) { |
| 66 | 70 | return client.call('repo-tags', { name }) |
| 67 | 71 | } |
| 68 | 72 | |
| 73 | // Default branch. HEAD used to be per-backend, so nodes disagreed and the |
| 74 | // public saw whichever the load balancer hit; it is replicated now, but a |
| 75 | // repo whose nodes already disagree gets seeded by whichever writer |
| 76 | // reconciles first. This makes that a deliberate choice rather than a race. |
| 77 | if (sub === 'set-head') { |
| 78 | const name = args[1] |
| 79 | const ref = args[2] |
| 80 | if (!name || !ref) throw new Error('usage: pgh repo set-head <name> <branch>') |
| 81 | return client.call('repo-set-head', { name, ref }) |
| 82 | } |
| 83 | |
| 69 | 84 | // Host a new bare repo in one call: init --bare + symbolic-ref HEAD + scan + |
| 70 | 85 | // serve, all daemon-side. Must be matched BEFORE the bare-name fallthrough at |
| 71 | 86 | // the bottom, or `create` would be read as a repo name to show. |