Skip to content

Clone each repository once when it ships several addons (closes #52) - #53

Merged
refaim merged 1 commit into
masterfrom
fix-repeated-clones
Aug 30, 2026
Merged

Clone each repository once when it ships several addons (closes #52)#53
refaim merged 1 commit into
masterfrom
fix-repeated-clones

Conversation

@refaim

@refaim refaim commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Fixes #52.

A repository providing several addons was cloned and reinstalled once per addon, and the progress counter grew quadratically with the size of each repository group.

Changes

  • get_addon_states — request remote state once per distinct (url, branch) instead of once per addon. fetch_states used to yield one RemoteState per duplicate request, and each of those was fanned out across every addon of the repository, giving Σ group_size² progress increments. The counter now runs 1/N..N/N.
  • cmd_update — group the selected addons by (url, branch) and call install_addon once per repository. install_addon has always been repository-level: it clones once and installs every addon it finds.
  • mygit.fetch_states — keep per-remote branches in an ordered set, so the module itself guarantees one RemoteState per (url, branch) regardless of how the caller builds the request list. One list_heads() call per distinct URL, as before.
  • cmd_update — collapse identical per-repository errors into one line, so a broken repository with five addons no longer prints five identical messages.
  • toc.find_addons — name an addon after its folder rather than the .toc stem. With the standard multi-TOC layout (DBM-Core.toc + DBM-Core-WOTLKC.toc) the suffixed file used to win purely because rglob sorts - before ., so the addon was installed into AddOns/DBM-Core-WOTLKC/, breaking ## Dependencies: DBM-Core resolution (WoW resolves dependencies by folder name) and orphaning SavedVariables. The folder name now wins whenever the folder actually ships a matching base .toc; otherwise the stem is kept so the installed folder always contains a loadable <Folder>.toc.
  • install_addon — drop config entries whose addon has disappeared from the repository. Such entries can never advance their stored commit, so they stay outdated forever and pull a clone on every run. Detection scans the clone without the expansion filter, so an addon that merely does not match the current game version is never mistaken for a stale one. The folder is deleted only when its checksum still validates; a hand-edited folder is left in place with a warning and shows up as untracked.

Verification

Measured with the repositories from the issue — ElvUI-WotLK/ElvUI (2 addons), ElvUI_AddOnSkins, ElvUI_Enhanced, Bunny67/WeakAuras-WotLK (4 addons), Ascension-Addons/DeadlyBossMods (25 addons), Zendevve/OmniInv-WoW — 34 addons across 6 repositories:

before after
clones per update 34 6
installs 648 34
progress counter 648/34 34/34

The installed tree was checked afterwards: all 34 folders contain the <Folder>.toc the 3.3.5 client loads, no required dependency is unresolved, WeakAuras/Libs/** stays nested instead of being split into separate addons, and the installed files match the source repositories exactly.

209 tests pass (including the integration suite) with 100% line and branch coverage.

🤖 Generated with Claude Code

A repository providing several addons was cloned and reinstalled once
per addon, and the progress counter grew quadratically with the size of
each repository group.

- get_addon_states: request remote state once per distinct (url, branch)
  instead of once per addon, so the counter runs 1/N..N/N
- cmd_update: group selected addons by (url, branch) and clone each
  repository once
- mygit.fetch_states: keep per-remote branches in an ordered set so the
  module itself guarantees one RemoteState per (url, branch)
- cmd_update: collapse identical per-repository errors into one line
- toc.find_addons: name an addon after its folder rather than the .toc
  stem, falling back to the stem when the folder ships no matching base
  .toc; multi-TOC addons no longer install under a suffixed folder name
  that breaks dependency resolution
- install_addon: drop config entries whose addon disappeared from the
  repository, deleting the folder only when its checksum still validates

Measured on the repositories from the issue (34 addons across 6
repositories): 6 clones instead of 34, 34 installs instead of 648.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9859ba6) to head (43e5e8f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #53   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          551       583   +32     
  Branches        88        97    +9     
=========================================
+ Hits           551       583   +32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@refaim
refaim merged commit 3ed2d2b into master Aug 30, 2026
7 checks passed
@refaim
refaim deleted the fix-repeated-clones branch August 30, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect addon count and repeated downloads for multiple addons within a repo

1 participant