fix(install): re-clone interrupted (commit-less) checkout instead of failing

An interrupted previous clone leaves the install dir's .git present but with
no initial commit. rev-parse --is-inside-work-tree and git status both still
succeed there, so the installer entered the update path and ran `git stash`,
which aborts with "You do not have the initial commit yet" and failed the
desktop install at the "Cloning Hermes repository" stage.

- install.ps1: add a `git rev-parse --verify HEAD` probe to the repo-validity
  check so a commit-less checkout is treated as broken and re-cloned fresh.
- install.sh: mirror it at the top of clone_repo() — drop a partial checkout
  with no resolvable HEAD so the fresh-clone path handles it (POSIX parity).

Fixes #40998
This commit is contained in:
xxxigm
2026-06-08 02:18:21 -07:00
committed by Teknium
parent 0904bc7ea2
commit fc0900d120
2 changed files with 24 additions and 4 deletions
+9
View File
@@ -1092,6 +1092,15 @@ show_manual_install_hint() {
clone_repo() {
log_info "Installing to $INSTALL_DIR..."
# An interrupted previous clone leaves a .git with no initial commit, where
# the update path's `git stash` / `git checkout` abort with "You do not
# have the initial commit yet" and fail the install (#40998). Drop such a
# partial checkout so the fresh-clone path below handles it cleanly.
if [ -d "$INSTALL_DIR/.git" ] && ! git -C "$INSTALL_DIR" rev-parse --verify HEAD >/dev/null 2>&1; then
log_warn "Existing checkout at $INSTALL_DIR has no commits (interrupted clone) -- replacing it."
rm -rf "$INSTALL_DIR"
fi
if [ -d "$INSTALL_DIR" ]; then
if [ -d "$INSTALL_DIR/.git" ]; then
log_info "Existing installation found, updating..."