xonecas.io
8356
Wx

www-xonecas-io / files

www-xonecas-io / tickets / 1004-consolidate-duplicate-repos-by-shared-root.md

2.8 KB
1---
2id: 1004
3title: Consolidate duplicate repos by shared root commit
4type: feature
5status: done
6priority: p1
7area: data
8created: 2026-11-07T19:30:00Z
9updated: 2026-11-08T03:58:15Z
10source: agent
11moves: 2026-11-07T19:30:00Z inbox todo agent; 2026-11-08T01:09:35Z todo doing drag; 2026-11-08T01:24:36Z doing review agent; 2026-11-08T03:58:15Z review done drag
12---
13
14Generate the project list from git: remotes sharing a root commit are one project, and every source is kept and listed on it.
15
16Expected result: 105 GitHub and GitLab remotes become 103 projects. vim-night-lights = gh night-lights + gl vim-night-lights. js-algos = gh Algos + gl js-algos. The canonical name and default branch come from the remote with the most commits, and the other remote's refs stay reachable.
17
18Needs from xonecas: dotfiles has 3 separate root commits (2014 gh, 2020 gl, 2026 gh). I recommend 3 projects, as the histories are unrelated, named by era in the URL. The alternative is one project with 3 eras, set by an override file.
19
20Done when: the output matches the counts in repos.md on 1000, and an override file can merge or rename a project.
21
22## Notes
23
24- 2026-11-08 01:11Z (agent): Decision from xonecas (terminal): dotfiles is 3 projects, named by era.
25
26- 2026-11-08 01:24Z (agent): Done: 'make index' groups the 105 remotes into 103 projects by shared root commit, which matches repos.md on 1000.
27  
28  RESULT:
29  - vim-night-lights = gl vim-night-lights (5 commits, canonical) + gh night-lights (2).
30  - js-algos = gl js-algos (21, canonical) + gh Algos (8).
31  - dotfiles is 3 projects, named by era as decided: dotfiles-2014 (gh xonecas, 80), dotfiles-2020 (gl xonecas, 5) and dotfiles (gh sacenox, 101). If names collide, every project but the newest gets its start year.
32  - githubstopannoyingme is a project with 0 commits.
33  - The other 98 remotes are one project each.
34  
35  HOW:
36  - internal/project reads, for each mirror, its branch, commit count, root commits and first date. It joins remotes that share any root, using union-find. The remote with the most commits is canonical: it gives the name and the default branch, and it is sources[0]. Every source stays in its own mirror, so each remote's refs stay reachable.
37  - overrides.txt holds 'merge <url> <url>' and 'rename <name> <new>'. It ships empty, with the rules described in its comments. A bad rule or an unknown URL fails with the line number.
38  - Output: data/projects.json (gitignored and regenerated). Two runs give byte-identical output.
39  
40  CHECKED: unit tests for the grouping, era names, merge, rename, bad rules and a missing file. Against the real store, a scratch overrides file renamed vim-night-lights and merged the 2014 and 2020 dotfiles: 102 projects, as expected.
41  NOT CHECKED: the 82 / 20 / 1 split into your own projects, forks and empty. That is 1005's job (forks are hidden there).