Skip to content

feat: show progress for long-running actions (pull, fetch, push, checkout, AI) - #84

Merged
maxbolgarin merged 2 commits into
mainfrom
claude/modest-sagan-wouzsi
Oct 15, 2026
Merged

maxbolgarin merged 2 commits into
mainfrom
claude/modest-sagan-wouzsi

Conversation

@maxbolgarin

@maxbolgarin maxbolgarin commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Fixed the silent stall after a big pull. After "✓ Pulled using fast-forward", print_changes_stat started 3 sed processes per stat line, so 2000 changed files took about 20s with no output. It now does one awk pass (about 0.04s). Pull and merge cap the list at 100 rows and add ... and N more files. Hyphens in file names are no longer colored red.
  • Fast-forward pull shows checkout progress. git merge --ff-only --no-stat --progress runs through stream_or_capture_git. The stat is printed from old_head..HEAD, so a streamed run doesn't dump the raw diffstat a second time.
  • Every long action now shows progress. New helpers in common.sh:
    • a spinner with elapsed seconds, e.g. ⠋ Fetching (3s), that appears after ~1s, so quick commands print nothing extra;
    • stream_or_capture_git shows that spinner during its quiet window, then hands over to git's own progress after ~10s. Progress meters are stripped from the captured text, so callers parse the same output as before;
    • run_with_spinner for work that isn't git, and readable labels ("Fetching", "Pushing", "Checking out files", "Applying stash", …).
  • Converted call sites:
    • fetch/push in branch, config, fetch, merge, pull (dry and upd), sync, tag, edit, squash, wip, worktree;
    • switch and checkout, merge, stash push/pop/apply/drop, worktree add;
    • AI requests: HTTP providers and the claude CLI ("Waiting for AI response"), and commit grouping ("Grouping changes with AI").
  • When the spinner is off: without a TTY (tests/CI), with GITBASHER_NO_SPINNER=1, and for network commands where git may prompt for credentials (HTTPS with no credential helper or askpass, SSH with no agent). The spinner redraws its line, so it would otherwise wipe the prompt.

Linked issue

None. This came from a user report: a large gitb pull showed no progress.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor (no behavior change)
  • Documentation only (also touched: ARCHITECTURE.md section and FAQ entry)

Test plan

  • Full bats tests/ run: 946 pass. The 37 failures are identical on unmodified main in this environment (column is not installed); none are new.
  • shellcheck — not available in this environment
  • Built bundle passes bash -n
  • Manually tested in a pty (script -qc):
# 3000-file fast-forward pull: fetch progress -> "Updating files: …%" -> capped stat
GITBASHER_PROGRESS_QUIET_TICKS=1 script -qc "gitb pull" /dev/null
# switch between branches 3000 files apart: "⠋ Checking out files (4s)", cleared on finish
# run_with_spinner around a 2s function: spinner shown, stdout and exit code 3 preserved

New BATS tests:

  • print_changes_stat: limit, create mode rows, hyphen coloring, empty input;
  • fast-forward pull end-to-end;
  • strip_git_progress, _progress_label, run_with_spinner passthrough, no spinner without a TTY, and the credential-prompt heuristic.

Compatibility

  • Works on macOS (BSD userland). No sed '\r', no head -n 0, and colors reach awk through ENVIRON.
  • Works on Linux (GNU userland). Tested with mawk.
  • Bash 3.2 compatible (tests/bash32_compat_check.sh passes)

Checklist

  • Commit messages follow Conventional Commits
  • Variables in git invocations are quoted
  • No new xargs -r / GNU-only patterns
  • BATS tests added for non-trivial behavior changes
  • README / CONTRIBUTING updated if user-facing behavior changed (FAQ + ARCHITECTURE)

🤖 Generated with Claude Code

https://claude.ai/code/session_01FijY3tAxpvX9dgMwau3u7T

- Fast-forward now runs through stream_or_capture_git with --progress, so
  git's "Updating files" checkout progress appears once it outlives the
  quiet window. --no-stat keeps a streamed run from dumping the raw
  diffstat; the stat is printed from old_head..HEAD instead.
- print_changes_stat colors in a single awk pass instead of spawning
  three sed processes per line (a 2000-file pull spent ~20s here with no
  output). It takes an optional row limit (pull/merge use 100) and
  collapses the rest into "... and N more files".
- Hyphens in file names are no longer colored red; trailing
  "create mode" rows from git merge stay after the summary line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FijY3tAxpvX9dgMwau3u7T
- New common.sh helpers: a spinner with elapsed seconds (appears after
  ~1s, so quick commands stay quiet), run_with_spinner for non-git work,
  strip_git_progress, and readable labels ("Fetching", "Checking out
  files", ...).
- stream_or_capture_git now spins during its quiet window and still
  hands over to git's native progress after ~10s; captured output has
  progress meters stripped so callers parse the same text as before.
- Route fetch/push in branch, config, fetch, merge, pull (dry/upd), sync,
  tag, edit, squash, wip and worktree through it, plus switch/checkout,
  merge, stash and worktree add, which can take long on big trees.
- AI requests (HTTP and claude CLI, commit grouping) show "Waiting for
  AI response" / "Grouping changes with AI".
- Spinner is off without a TTY, with GITBASHER_NO_SPINNER=1, and for
  network commands that may prompt for credentials so the prompt is not
  overwritten.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FijY3tAxpvX9dgMwau3u7T
@maxbolgarin maxbolgarin changed the title feat(pull): show progress for large pulls and stop hanging on huge stats feat: show progress for long-running actions (pull, fetch, push, checkout, AI) Oct 15, 2026
@maxbolgarin
maxbolgarin merged commit bb9eec4 into main Oct 15, 2026
8 checks passed
@maxbolgarin
maxbolgarin deleted the claude/modest-sagan-wouzsi branch October 15, 2026 09:56
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 5.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants