Skip to content

Add --verbose / -v diagnostic mode - #17

Closed
HarshRajSinghania wants to merge 7 commits into
alibro005:mainfrom
HarshRajSinghania:feat/verbose-mode
Closed

HarshRajSinghania wants to merge 7 commits into
alibro005:mainfrom
HarshRajSinghania:feat/verbose-mode

Conversation

@HarshRajSinghania

Copy link
Copy Markdown
Contributor

Summary

Adds a --verbose / -v flag so BeforePush can print extra Git diagnostics when a check is hard to interpret, without changing default output, check results, or exit codes.

Fixes #16.

Motivation

Issue #16 asked for a debug mode that keeps the current concise report and only adds details useful for troubleshooting (repo path, HEAD, dirty files, remotes/upstream, and Git error context).

Implementation

  • CLI: -v / --verbose on beforepush.
  • CheckResult.details carries optional diagnostic lines; populated only when verbose=True.
  • Output prints those lines under each check and a short "Verbose diagnostics enabled" marker.
  • Git helpers: get_repo_root, get_head_sha, get_remote_summary.
  • Newly installed pre-push hooks honor BEFOREPUSH_VERBOSE so BEFOREPUSH_VERBOSE=1 git push runs beforepush --verbose.
  • Existing hooks that already call beforepush are unchanged; users can still run beforepush -v directly.

Testing

Ran locally:

PYTHONPATH=src python3 -m pytest -q

Result: 57 passed (including new tests in tests/test_verbose.py).

Covered:

  • --verbose and -v enable verbose mode
  • default output does not include the verbose header or repository diagnostics
  • verbose working-tree failures list porcelain status lines
  • exit code remains non-zero when a check fails under --verbose

@alibro005

Copy link
Copy Markdown
Owner

@HarshRajSinghania Thanks for the contribution. This issue is already being addressed in another PR, so I’m closing this to avoid duplicate work.

For future issues, please comment first to coordinate before starting work.

@alibro005 alibro005 closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --verbose / -v debug mode

2 participants