From 4f650ddd5703a3665b95dc1b66de99dcd57a8b53 Mon Sep 17 00:00:00 2001 From: RelaxJonh <92573950+RelaxJonh@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:53:07 +0700 Subject: [PATCH] fix(update): preserve --depth 1 on shallow installs during update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #80049 --- hermes_cli/update_cmd.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.py index c99d56a81e18b..148bdba7b4f04 100644 --- a/hermes_cli/update_cmd.py +++ b/hermes_cli/update_cmd.py @@ -3744,9 +3744,22 @@ def _cmd_update_impl(args, gateway_mode: bool): # against. branch = _m()._resolve_update_branch(args) + # Detect shallow repo — a plain `git fetch` would unshallow it, + # dragging in the entire history (the exact cost `--depth 1` avoided). + is_shallow = ( + subprocess.run( + git_cmd + ["rev-parse", "--is-shallow-repository"], + cwd=_m().PROJECT_ROOT, + capture_output=True, + text=True, encoding="utf-8", errors="replace", + ).stdout.strip() + == "true" + ) + depth_args = ["--depth", "1"] if is_shallow else [] + print("→ Fetching updates...") fetch_result = subprocess.run( - git_cmd + ["fetch", "origin", branch], + git_cmd + ["fetch"] + depth_args + ["origin", branch], cwd=_m().PROJECT_ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace",