Skip to content

fix(installer): clear unmerged index before installer autostash - #45589

Merged
teknium1 merged 2 commits into
mainfrom
salvage/45515-installer-unmerged-index
Jun 13, 2026
Merged

fix(installer): clear unmerged index before installer autostash#45589
teknium1 merged 2 commits into
mainfrom
salvage/45515-installer-unmerged-index

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Installer update paths now recover when an existing managed checkout has an unmerged git index before autostashing.

Salvages #45515 by @xxxigm onto current main, preserving contributor authorship. The bug is the same state already handled by the Python hermes update path: an interrupted update leaves index conflict markers, so git stash fails with could not write index and the later git checkout main fails.

Changes

  • scripts/install.sh: detect git ls-files --unmerged, run git reset -q, then stash normally.
  • scripts/install.ps1: same unmerged-index clear before stash for the Windows installer path.
  • tests/test_install_unmerged_index.py: regression test for the bash autostash block plus source-order checks for both installers.

Validation

Check Result
scripts/run_tests.sh tests/test_install_unmerged_index.py 3 passed
Live throwaway git repro before reset: stash rc=1 with could not write index; after reset: unmerged cleared, stash rc=0, changes preserved

Original PR: #45515

Infographic

Installer Self-Heal

xxxigm added 2 commits June 13, 2026 05:18
When an existing install at $INSTALL_DIR has an unmerged index (files in a
"needs merge" state left by a previously interrupted update), the update path
ran `git stash` then `git checkout <branch>`. On a conflicted index `git stash`
aborts with "could not write index" and `git checkout` then aborts with "you
need to resolve your current index first" — surfacing to desktop/bootstrap
users as `git checkout main failed (exit 1)` and failing the whole install at
the repository stage.

Mirror the `hermes update` Python path (#4735): detect unmerged entries with
`git ls-files --unmerged` and clear the conflict state with `git reset` before
stashing. Working-tree changes are still captured by the subsequent stash, so
nothing is discarded; only the index-level conflict markers are dropped, which
lets the checkout proceed.

Fixed in both installers (install.sh and install.ps1) so the Windows GUI
installer and the POSIX one share the same recovery behavior.
Functional bash test drives install.sh's autostash block against a throwaway
repo with a real conflicted index and asserts the stash now succeeds and the
unmerged entries are cleared (previously `git stash` failed with "could not
write index"). Source-order assertions cover both scripts to ensure the
`git reset` clear runs before `git stash push` (a no-op otherwise).
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/45515-installer-unmerged-index vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10890 on HEAD, 10890 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5713 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1
teknium1 merged commit a59d5e3 into main Jun 13, 2026
28 checks passed
@teknium1
teknium1 deleted the salvage/45515-installer-unmerged-index branch June 13, 2026 12:49
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.

2 participants