Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion hermes_cli/update_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading