Skip to content

fix(update): preserve --depth 1 on shallow installs during update - #80124

Closed
JonthanaHanh wants to merge 1 commit into
NousResearch:mainfrom
JonthanaHanh:fix/update-shallow-fetch-80049
Closed

JonthanaHanh wants to merge 1 commit into
NousResearch:mainfrom
JonthanaHanh:fix/update-shallow-fetch-80049

Conversation

@JonthanaHanh

Copy link
Copy Markdown
Contributor

Summary

The --check path correctly detects shallow repos and appends --depth 1 to fetch commands (lines 2238-2247), but the actual update path did a bare git fetch origin branch without depth args. On shallow installs (the default from the installer), this unshallows the repo and drags in the entire git history.

Problem

hermes update on a shallow git install triggers a full unshallow fetch (missing --depth 1 in the update path) and shows no progress output while doing it. The terminal sits at "Fetching updates..." for 20+ minutes because it's downloading 179,583+ objects.

Observed on a mainland-China network: 42 MB in ~9 minutes and nowhere near done, because the full repo history was being fetched when only the shallow boundary was needed.

Root cause

hermes_cli/update_cmd.py line 3749 (before this fix):

git_cmd + ["fetch", "origin", branch],   # no --depth 1

The --check path at line 2238-2247 correctly does:

is_shallow = (subprocess.run(git_cmd + ["rev-parse", "--is-shallow-repository"], ...).stdout.strip() == "true")
deppth_args = ["--depth", "1"] if is_shallow else []

But the actual update fetch did not reuse this logic.

Fix

Added the same shallow detection before the update fetch, and append depth_args to the fetch command. When the repo is shallow, --depth 1 is passed to preserve the boundary. When not shallow, no args are added (full fetch is fine).

Changes

  • hermes_cli/update_cmd.py: Add is_shallow detection and depth_args before the update fetch

Fixes #80049

The `--check` path correctly detects shallow repos and appends
`--depth 1` to fetch commands (line 2238-2247), but the actual
update path at line 3749 did a bare `git fetch origin branch`
without depth args. On shallow installs (the default from the
installer), this unshallows the repo and drags in the entire git
history — causing `hermes update` to hang for 20+ minutes on slow
networks while downloading 179K+ objects.

Add the same shallow detection before the update fetch so that
`--depth 1` is preserved when the repo is shallow.

Fixes NousResearch#80049
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 6, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks @JonthanaHanh — the "Found 9980 new commit(s)" symptom on issue #80049 is fixed on main by PR #86318, which makes the apply path treat the shallow-boundary count as unknown and recover the real number via the GitHub compare API (hermes_cli/update_cmd.py, tests/hermes_cli/test_update_apply_shallow_count.py), rather than adding --depth 1 to the apply fetch. Closing as implemented-on-main — thanks for pinpointing the check-vs-apply asymmetry, which is exactly what the landed fix addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes update: full unshallow fetch on shallow installs (missing --depth 1 in update path) + no progress output

4 participants