Skip to content
Open
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
24 changes: 17 additions & 7 deletions hermes_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9615,6 +9615,11 @@ def _cmd_update_impl(args, gateway_mode: bool):
print(f" {stderr.splitlines()[0]}")
sys.exit(1)

# Show fetch progress (git sends progress to stderr)
if fetch_result.stderr.strip():
for line in fetch_result.stderr.strip().splitlines():
print(f" {line}")

# Get current branch (returns literal "HEAD" when detached)
result = subprocess.run(
git_cmd + ["rev-parse", "--abbrev-ref", "HEAD"],
Expand Down Expand Up @@ -9672,13 +9677,7 @@ def _cmd_update_impl(args, gateway_mode: bool):
print(f" {track_result.stderr.strip().splitlines()[0]}")
sys.exit(1)
else:
auto_stash_ref = _stash_local_changes_if_needed(git_cmd, PROJECT_ROOT)

prompt_for_restore = (
auto_stash_ref is not None
and not assume_yes
and (gateway_mode or (sys.stdin.isatty() and sys.stdout.isatty()))
)
auto_stash_ref = None

# Check if there are updates
result = subprocess.run(
Expand All @@ -9690,6 +9689,17 @@ def _cmd_update_impl(args, gateway_mode: bool):
)
commit_count = int(result.stdout.strip())

# Only stash when there are actual updates to pull (avoids unnecessary
# stash/restore cycle when the checkout is already up to date)
if auto_stash_ref is None and commit_count > 0:
auto_stash_ref = _stash_local_changes_if_needed(git_cmd, PROJECT_ROOT)

prompt_for_restore = (
auto_stash_ref is not None
and not assume_yes
and (gateway_mode or (sys.stdin.isatty() and sys.stdout.isatty()))
)

if commit_count == 0:
_invalidate_update_cache()

Expand Down
Loading