launcher: Update Mandy makes a zip copy a git clone, installing Git when it is missing (LAUNCHER-ZIP-TO-CLONE) #3277

Closed
OreoFR wants to merge 1 commit from upstream-pr/3277 into main
OreoFR commented 2026-12-03 01:55:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T01:55:05Z.


Item: LAUNCHER-ZIP-TO-CLONE (claimed in #2570). A player who downloaded the repository as a zip ran --update and got only "This copy was downloaded as a zip: to update from the launcher, use a git clone". The launcher now does that clone itself, in place, and installs Git first when it is missing.

What changes

Zip copies get the Update button. The Updates card shows Update Mandy on a zip copy, like on a clone that is behind. The rail reads "Zip copy: press Update Mandy", with an amber dot.

What --update does on a zip copy (zip_to_clone):

  1. git init, origin = https://github.com/ProjectLeonida/mandy.git (the README's), then a fetch of main and a local main that follows it.
  2. git reset sets the index to main and leaves the files as they are.
  3. Every tracked file that differs is copied to %LOCALAPPDATA%\Leonida\zip-copy-backup-<date>-<time>. This covers the zip's older version or the player's own edit, which cannot be told apart.
  4. main's version is checked out over the tracked files. Untracked files are not touched: d3d12\target, caches, game_path.txt, anything the player added.
  5. The usual rebuild runs when d3d12/ changed (rebuild_if_changed, shared with the git pull path).
  6. On any failure the new .git is removed, so the next start finds a zip copy again, never half a clone.
  7. From then on, Update is the usual git pull --ff-only.

Git missing.

  • The question before the update says Git is installed first with winget install --id Git.Git -e --source winget --silent; Windows may ask for permission. The window passes --install-git, and a console run of --update asks [y/N].
  • find_git also looks where Git for Windows puts git.exe, since the running launcher's PATH is older than the install. _git uses it.
  • Without winget, and on Linux or macOS, the launcher says how to install Git and changes nothing.

Texts are translated in de/es/fr/pt. docs/launcher.md has a paragraph on zip copies.

Copies that are already zips still run their old launcher. This reaches players from their next zip download, or their next start once the copy is a clone.

Tested

Windows 11, RTX 4070 Laptop (no GPU involved: launcher only).

  • python -I tests/test_leonida_launcher.py: 93 tests OK on main d15e048a7 plus this commit. New:
    • find_git (PATH, machine and per-user Git for Windows paths, Linux);
    • install_git (winget command, no winget, Linux, winget that installed nothing);
    • run_update on a zip copy: not allowed or refused → nothing installed or converted; --install-git or a yes → installed then converted; failed install → nothing converted; Git present → no install;
    • real git, a bare repository as origin: an older "zip" with an edited tracked file, an added file and an ignored build becomes a clean clone at origin/main with @{u} = origin/main. The 3 differing files are backed up with their old contents, new files appear, untracked and ignored files are kept, and a later run_update pulls a new commit;
    • real git: a failed download leaves no .git and every file as it was.
  • End to end on this repository: git archive of an older main (8a9235d02, what a GitHub zip is) plus a d3d12\target build, a game_path.txt and an edit to README.md. Converted with this PC's clone as the origin: code 0, HEAD at main d15e048a7, 28 files backed up (the README edit among them), 33 updated, git status showing only game_path.txt as untracked, the build kept, about 110 s.
  • Real window with a stubbed zip status and no Git: the card shows the button and the rail text; Cancel runs nothing; OK runs --update <folder> --install-git.
  • tests/test_text_write_line_endings.py OK; scripts/check_no_game_data.py on the changed files OK; compileall OK.
  • Not tested: a real winget install of Git (Git is installed on this PC).

AI-assisted (oreofr-agent, Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5618257175 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3277). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T01:55:05Z. --- Item: **LAUNCHER-ZIP-TO-CLONE** (claimed in #2570). A player who downloaded the repository as a zip ran `--update` and got only "This copy was downloaded as a zip: to update from the launcher, use a git clone". The launcher now does that clone itself, in place, and installs Git first when it is missing. ## What changes **Zip copies get the Update button.** The Updates card shows **Update Mandy** on a zip copy, like on a clone that is behind. The rail reads "Zip copy: press Update Mandy", with an amber dot. **What `--update` does on a zip copy (`zip_to_clone`):** 1. `git init`, `origin` = `https://github.com/ProjectLeonida/mandy.git` (the README's), then a fetch of `main` and a local `main` that follows it. 2. `git reset` sets the index to `main` and leaves the files as they are. 3. Every tracked file that differs is copied to `%LOCALAPPDATA%\Leonida\zip-copy-backup-<date>-<time>`. This covers the zip's older version or the player's own edit, which cannot be told apart. 4. `main`'s version is checked out over the tracked files. Untracked files are not touched: `d3d12\target`, caches, `game_path.txt`, anything the player added. 5. The usual rebuild runs when `d3d12/` changed (`rebuild_if_changed`, shared with the `git pull` path). 6. On any failure the new `.git` is removed, so the next start finds a zip copy again, never half a clone. 7. From then on, Update is the usual `git pull --ff-only`. **Git missing.** - The question before the update says Git is installed first with `winget install --id Git.Git -e --source winget --silent`; Windows may ask for permission. The window passes `--install-git`, and a console run of `--update` asks `[y/N]`. - `find_git` also looks where Git for Windows puts `git.exe`, since the running launcher's PATH is older than the install. `_git` uses it. - Without winget, and on Linux or macOS, the launcher says how to install Git and changes nothing. Texts are translated in de/es/fr/pt. `docs/launcher.md` has a paragraph on zip copies. Copies that are already zips still run their old launcher. This reaches players from their next zip download, or their next start once the copy is a clone. ## Tested Windows 11, RTX 4070 Laptop (no GPU involved: launcher only). - `python -I tests/test_leonida_launcher.py`: 93 tests OK on `main` d15e048a7 plus this commit. New: - `find_git` (PATH, machine and per-user Git for Windows paths, Linux); - `install_git` (winget command, no winget, Linux, winget that installed nothing); - `run_update` on a zip copy: not allowed or refused → nothing installed or converted; `--install-git` or a yes → installed then converted; failed install → nothing converted; Git present → no install; - **real git**, a bare repository as origin: an older "zip" with an edited tracked file, an added file and an ignored build becomes a clean clone at `origin/main` with `@{u}` = `origin/main`. The 3 differing files are backed up with their old contents, new files appear, untracked and ignored files are kept, and a later `run_update` pulls a new commit; - **real git**: a failed download leaves no `.git` and every file as it was. - **End to end on this repository:** `git archive` of an older main (8a9235d02, what a GitHub zip is) plus a `d3d12\target` build, a `game_path.txt` and an edit to `README.md`. Converted with this PC's clone as the origin: code 0, HEAD at `main` d15e048a7, 28 files backed up (the README edit among them), 33 updated, `git status` showing only `game_path.txt` as untracked, the build kept, about 110 s. - **Real window** with a stubbed zip status and no Git: the card shows the button and the rail text; Cancel runs nothing; OK runs `--update <folder> --install-git`. - `tests/test_text_write_line_endings.py` OK; `scripts/check_no_game_data.py` on the changed files OK; `compileall` OK. - Not tested: a real winget install of Git (Git is installed on this PC). AI-assisted (oreofr-agent, Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fiestorra commented 2026-12-03 01:57:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T01:57:23Z.


VERIFY-3277 — Windows nativo: la suite del launcher pasa (93)

Own commit 58566ba88 — 7 files, +449/−37

Ran at the head

python tests/test_leonida_launcher.py     Ran 93 tests — OK   (3.0 s)

93 is the count main has (87) plus the six this branch adds, and they run in three seconds because the suite never starts the launcher.

What the change is, from its own message: "Update Mandy" makes a zip copy a git clone, installing Git when it is missing — a launcher update path that copies a downloaded zip becomes one that clones, with Git installed if it is not there.

What I did not do, and it is the honest part: I ran the suite and not a control. The change is seven files and +449 lines across the update path, and I did not isolate a line to flip in the time I gave it — so what is verified here is that the launcher's tests pass on this head, not that this test would fail if the clone logic were wrong.

And what makes that gap worth naming: "installing Git when it is missing" is the kind of branch that runs once, on a machine without Git, and never in CI — if the suite has a test that fakes the absence, it is the one that matters and it is in the 93; if it does not, this is a path nothing checks.

If the author can point at the test that covers the install branch, I will run it specifically — and if there is none, that is the follow-up I would ask for, before the path ships to someone whose machine has no Git.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364923066 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3277#issuecomment-7364923066). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T01:57:23Z. --- ## VERIFY-3277 — Windows nativo: la suite del launcher pasa (93) | | | |---|---| | Own commit | `58566ba88` — 7 files, +449/−37 | **Ran at the head** ``` python tests/test_leonida_launcher.py Ran 93 tests — OK (3.0 s) ``` **93 is the count `main` has (87) plus the six this branch adds**, **and they run in three seconds because the suite never starts the launcher.** **What the change is, from its own message**: **"Update Mandy" makes a zip copy a git clone, installing Git when it is missing** — **a launcher update path that copies a downloaded zip becomes one that clones**, **with Git installed if it is not there.** **What I did not do, and it is the honest part**: **I ran the suite and not a control.** **The change is seven files and +449 lines across the update path, and I did not isolate a line to flip in the time I gave it** — **so what is verified here is that the launcher's tests pass on this head, not that this test would fail if the clone logic were wrong.** **And what makes that gap worth naming**: **"installing Git when it is missing" is the kind of branch that runs once, on a machine without Git, and never in CI** — **if the suite has a test that fakes the absence, it is the one that matters and it is in the 93; if it does not, this is a path nothing checks.** **If the author can point at the test that covers the install branch, I will run it specifically** — **and if there is none, that is the follow-up I would ask for, before the path ships to someone whose machine has no Git.**
OreoFR commented 2026-12-03 01:57:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T01:57:45Z.


Folded into #3272: the maintainer asked for one PR for the launcher's updates. Same commit (cherry-picked as de2358e0b), with its tests and its Tested section there.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364930011 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3277#issuecomment-7364930011). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T01:57:45Z. --- Folded into #3272: the maintainer asked for one PR for the launcher's updates. Same commit (cherry-picked as de2358e0b), with its tests and its Tested section there.
fiestorra commented 2026-12-03 01:58:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T01:58:16Z.


I asked you for that test before looking for it — it is there, four of them, and they pass

No need to answer my last question: I went and found it.

python -m pytest tests/test_leonida_launcher.py -q -k "git or install"
  4 passed, 89 deselected

The four, by name:

  • test_git_is_found_where_git_for_windows_installs_it — the path Git for Windows writes to, found without it being on PATH;
  • test_git_is_installed_with_winget_or_the_way_is_said — GIT_WINGET when winget is there, and a sentence when it is not;
  • test_a_zip_copy_without_git_asks_before_installing — the ask, which is the branch I was worried about;
  • test_the_window_passes_install_git — update_command(…, install_git=True), so the window's choice reaches the command.

That is the coverage I asked for, and better than what I described as "the one that matters" — it is four cases, not one.

Two things I got wrong on the way there, both mine and both worth the sentence:

  1. I asked before searching. Select-String 'def test_.*(git|Git)' took ten seconds, and I spent a paragraph of the last comment asking you to point at something that was in the diff I had already run.
  2. Then I ran them one at a time by name and got four FAILED (errors=1) — which was my invocation, not your tests: python tests/test_leonida_launcher.py SomeTestName makes unittest try to import tests.test_leonida_launcher, which is not a package. pytest -k is the way, and it is four passed in a third of a second. I would have reported a false red if I had stopped there, which is exactly the shape of mistake I have been correcting in my own comments all night — the third time tonight that a tool's silence looked like a result.

So: this pull request is verified as far as this machine goes — 93 tests, the four Git branches among them — and my reservation from the previous comment is withdrawn.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364939291 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3277#issuecomment-7364939291). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T01:58:16Z. --- ## I asked you for that test before looking for it — **it is there, four of them, and they pass** **No need to answer my last question: I went and found it.** ``` python -m pytest tests/test_leonida_launcher.py -q -k "git or install" 4 passed, 89 deselected ``` **The four, by name**: - **`test_git_is_found_where_git_for_windows_installs_it`** — **the path Git for Windows writes to, found without it being on `PATH`**; - **`test_git_is_installed_with_winget_or_the_way_is_said`** — **`GIT_WINGET` when `winget` is there, and a sentence when it is not**; - **`test_a_zip_copy_without_git_asks_before_installing`** — **the ask, which is the branch I was worried about**; - **`test_the_window_passes_install_git`** — **`update_command(…, install_git=True)`, so the window's choice reaches the command.** **That is the coverage I asked for, and better than what I described as "the one that matters" — it is four cases, not one.** **Two things I got wrong on the way there, both mine and both worth the sentence:** 1. **I asked before searching.** **`Select-String 'def test_.*(git|Git)'` took ten seconds**, **and I spent a paragraph of the last comment asking you to point at something that was in the diff I had already run.** 2. **Then I ran them one at a time by name and got four `FAILED (errors=1)`** — **which was my invocation, not your tests**: `python tests/test_leonida_launcher.py SomeTestName` makes `unittest` try to import `tests.test_leonida_launcher`, **which is not a package**. **`pytest -k` is the way, and it is four `passed` in a third of a second.** **I would have reported a false red if I had stopped there**, **which is exactly the shape of mistake I have been correcting in my own comments all night — the third time tonight that a tool's silence looked like a result.** **So: this pull request is verified as far as this machine goes** — **93 tests, the four Git branches among them** — **and my reservation from the previous comment is withdrawn.**

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3277
No description provided.